Code Monkey home page Code Monkey logo

vim-unittest's People

Contributors

h1mesuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

laurentalacoque

vim-unittest's Issues

Save and restore variables and options easily.

setup と teadown でオプションやらグローバル変数やらを個別に指定して保存/復元をするのがめんどい。

alignta で使ってる Vimenv を持ってこよう。

Utility functions for easy access to a specific range of context data.

テスト中の「カレント」バッファである context.dataファイルにおいて、ファイル中の特定のマーキングにもとづき、
その行へ移動したり、範囲の選択を行ったりする一連の関数が欲しい。

alignta のテストでやっているので、それをこちらに持ってこれれば。

Unexpected implicit modificationof an plugin's internal dictionary.

Consider this dummy plugin myplugin.vim:

let s:var = {}
function! s:get_SID()
    return matchstr(expand('<sfile>'), '<SNR>\d\+_')
endfunction
let s:SID = s:get_SID()
delfunction s:get_SID

function! myplugin#__context__()
    return { 'sid': s:SID, 'scope': s: }
endfunction

and a test suite for it (test_myplugin.vim):

let s:tc = unittest#testcase#new('MyPluginTests', myplugin#__context__())

 function! s:tc.SETUP()
     let s:sample = {}
     let s:sample['a'] = 'a'
     call self.set('s:var', s:sample)
endfunction

function! s:tc.test_one()
    call self.assert_equal('a', self.get('s:var')['a'])
endfunction

function! s:tc.test_two()
    call self.assert_equal('a', self.get('s:var')['a'])
endfunction

The first test case passes, however, the second - fails.
Vim(call):E716: Key not present in Dictionary: a

And it looks strange, since no modification has been done in the first test case. AFAIU the performed steps are like this:

  1. SETUP is called before test_one is executed.
  2. The internal dict has 'a' key.
  3. test_one is executed and is passes.
  4. test_two is executed and fails.

Aparently, at step 4 the internal dictionary has been reset for some reason.

UnitTest fails due to Internal error: undefined variable 'sAssertions'

APPLIES TO

branch master
commit 9277877
gvim v8.2, v9.0

DESCRIPTION

I tried to launch a dummy test case loaded in the current buffer using :UnitTest and it failed internally (no test launched).

  • When I switch to v0.5.1, everything works successfully

MESSAGE


Started at Wed 18 Oct 2023 05:15:42 PM CEST

------------------------------------------------------------------------------
Results

Errors:

  1) test_something.vim:  
    Error: function unittest#run[8]..<SNR>87_TestRunner_load_testcases[5]..script ~/temp/test_something.vim[1]..~/.vim/plugged/vim-unittest/autoload/unittest/testcase.vim[70]..function unittest#assertions#module, line 1
    Vim(return):E121: Undefined variable: s:Assertions

1 tests, 0 assertions, 0 failures, 1 errors

Finished in 0.130652 seconds.

TESTCASE

let s:tc = unittest#testcase#new("TestCase")
function! s:tc.test_one()
    call self.assert(1)
endfunction

"Pending" feature

テストを書いてると欲しくなる機能。
空のテストを "pending" とカウントすることは可能

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.