Coder Social home page Coder Social logo

vim-themis's Introduction

vim-themis's People

Contributors

blueyed avatar cohama avatar itchyny avatar koron avatar lambdalisue avatar machakann avatar milly avatar ni57721 avatar rhysd avatar ryym avatar thinca 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-themis's Issues

Color for F and . (dot style)

Is your feature request related to a problem?

No

Describe the solution you'd like

F...

I hope F will be red and . will be green

moreover

Is it possible to highlight more information such as function name?

How to test input() and similar prompt functions?

Hi,

is there a way to test code that uses input() or similar prompt functions?

For example, how to test this?

let g:added_name = ''
function! AddName() abort
  let g:added_name = input('Enter name', '')
endfunction

when i try to call the function from test, it just stucks:

let s:suite = themis#suite('Test add name')

function! s:suite.test_add_name() abort
  call AddName()
endfunction

Only way i found is to wrap it in a function, and then mock it in the test. Is there maybe a better way?

scope helper

Is there currently a way to test script functions without creating an autoloading function for it?

for example if I have the following script:

" autoload/talk.vim
function! s:Greet(name) abort
  return "Hello " . a:name . ", how are you?"
endfunction

it would be cool to have a helper so I can do:

" test/talk.vim
let s:suite = themis#suite('talk')
let s:assert = themis#helper('assert')
let s:talk  = themis#scope('autoload/talk.vim')

function! s:suite.greet_makes_welcome_message()
  let l:welcome_message = s:talk.Greet('Nic')
  call s:assert.equals(l:welcome_message, 'Hello Nic, how are you?')
endfunction

Is this something that already exists? at the moment I'm sticking the following in my .themisrc and it feels quite messy:

let s:scriptnames_output = ""
let s:_scriptnames = []
function! s:scriptnames () abort
  redir => s:scriptnames_output
  silent scriptnames
  redir END
  let l:lines = split(s:scriptnames_output, "\n")
  let s:_scriptnames = map(l:lines, 'matchlist(v:val, ''^\s*\(\d\+\):\s*\(.\+\)$'')')
  return s:_scriptnames
endfunction

function! ForceLoad(namespace) abort
  try
    cal call(a:namespace . '#load', [])
  catch
  endtry
endfunction

function! GetSID(path) abort
  let l:matches = filter(copy(s:scriptnames()), 'v:val[2] =~ ''^.*' . a:path .'$''')
  if len(l:matches) < 1
    throw 'No matches found for path: ' . a:path
  endif
  if len(l:matches) > 1
    throw 'Multiple matches found for path: ' . a:path
  endif
  return str2nr(l:matches[0][1])
endfunction

function! ScriptCall(sid, name, ...) abort
  return call('<SNR>' . a:sid . '_' . a:name, a:000)
endfunction

Vim(call):E117: Unknown function: <SNR>18_themis_vimspec_scope_4 in Vim 7.3

An exception, Vim(call):E117: Unknown function: <SNR>18_themis_vimspec_scope_4, occur when sudo add-apt-repository ppa:pi-rho/dev -y is executed in install section of travis (mean Vim 7.4 is OK but Vim 7.3).

It worked previously thus probably I introduced some version dependent codes and the changes triggered the exception. However, the error message is not helped full thus I wonder if vim-themis can provide more user-friendly error message even in Vim 7.3

I know vim-themis does not officially support Vim 7.3 but vital.vim also test them functions in Vim 7.3 thus I'll be happy if you consider about this little issue.

お時間があればで結構ですので、よろしくお願いいたします。

Crashes on showing self-referencing container value

Repro

call themis#helper('command').with(themis#helper('assert'))

Describe test
    It should not crash
        let d = {}
        let d.x = d
        Assert IsNone(d)
    End
End

Put this file as foo.vimspec and run

$ /path/to/vim-themis/bin/themis foo.vimspec

Expected

It shows failure message correctly

Actual

It crashes with Vim exception

1..1
not ok 1 - test should not crash
# function 93() abort dict  Line:3  (/private/var/folders/xb/352hz3xn31z9zthlfl2pc03m0000gn/T/nvimpwwRhG/1)
# function <SNR>15_eval(expr, scopes) abort  Line:11  (~/.vim/bundle/vim-themis/autoload/themis/helper/command.vim)
# function <SNR>16_assert_is_none(value, ...) abort  Line:1  (~/.vim/bundle/vim-themis/autoload/themis/helper/assert.vim)
# function <SNR>16_check_type(value, expected_types, not, additional_message) abort  Line:24  (~/.vim/bundle/vim-themis/autoload/themis/helper/assert.vim)
#
# Vim(throw):E724: unable to correctly dump variable with self-referencing container

add first class support for async testing without sleep

Here is how most of javascript does this. They basically allows done argument in the test and the test framework checks the argument and if it has 1 arg it considers it as async.

https://jestjs.io/docs/en/asynchronous

test('the data is peanut butter', done => {
  function callback(data) {
    expect(data).toBe('peanut butter');
    done();
  }

  fetchData(callback);
});

Can we have something like this?

Async It should fetch data

call timer_start(5000, {t->Done()})

End

It does need to support default timeout and also allows us to specific custom timeouts which could be done by Async(10000) It should ...

This would make it easy to test async parts of vim-lsp.

Question: Next themis has support under 8.0 or below?

Currently, themis support Vim 7.4(in CI setting)

But themis used vital, and vital now unsupport under 8.0 or below(support only prev 8.0 and curr 8.1)

I have question for updating policy.
If themis's vital updated. just cut 7.4?

# I need to update themis, and add suppoort blob type check in current vital.

Seems broken with recent Vim

Environment

  • Vim 8.1p950 (MacVim snapshot-155)
  • macOS 10.12
  • shell: zsh 5.2
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 19 2019 12:07:42)
macOS version
Included patches: 1-950
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +cryptv            +fork()            +modify_fname      +perl              +tag_old_static    +viminfo
+arabic            +cscope            +fullscreen        +mouse             +persistent_undo   -tag_any_white     +vreplace
+autocmd           +cursorbind        -gettext           +mouseshape        +postscript        +tcl               +wildignore
+autochdir         +cursorshape       -hangul_input      +mouse_dec         +printer           +termguicolors     +wildmenu
-autoservername    +dialog_con_gui    +iconv             -mouse_gpm         +profile           +terminal          +windows
+balloon_eval      +diff              +insert_expand     -mouse_jsbterm     -python            +terminfo          +writebackup
+balloon_eval_term +digraphs          +job               +mouse_netterm     +python3           +termresponse      -X11
+browse            +dnd               +jumplist          +mouse_sgr         +quickfix          +textobjects       -xfontset
++builtin_terms    -ebcdic            +keymap            -mouse_sysmouse    +reltime           +textprop          +xim
+byte_offset       +emacs_tags        +lambda            +mouse_urxvt       +rightleft         +timers            -xpm
+channel           +eval              +langmap           +mouse_xterm       +ruby              +title             -xsmp
+cindent           +ex_extra          +libcall           +multi_byte        +scrollbind        +toolbar           -xterm_clipboard
+clientserver      +extra_search      +linebreak         +multi_lang        +signs             +transparency      -xterm_save
+clipboard         -farsi             +lispindent        -mzscheme          +smartindent       +user_commands
+cmdline_compl     +file_in_path      +listcmds          +netbeans_intg     +startuptime       +vartabs
+cmdline_hist      +find_in_path      +localmap          +num64             +statusline        +vertsplit
+cmdline_info      +float             +lua               +odbeditor         -sun_workshop      +virtualedit
+comments          +folding           +menu              +packages          +syntax            +visual
+conceal           -footer            +mksession         +path_extra        +tag_binary        +visualextra
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_F
ORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L.             -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.
sdk/usr/local/libressl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr
/local/lib -L.             -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/us
r/local/libressl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.Internal.sdk/usr/local
/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit  -L/usr/local/opt/lua/lib -ll
ua5.3 -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python/Frameworks/Python.framew
ork/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framewo
rk CoreFoundation -framework Ruby

Repro

Clone vim-themis

git clone https://github.com/thinca/vim-themis.git

Save test case to file foo.vimspec as follows:

call themis#helper('command').with(themis#helper('assert'))

Describe test
    It should pass
        Assert 1
    End
End

And run the script as follows:

./vim-themis/bin/themis foo.vimspec

Expected Behavior

It should output

1..1
ok 1 - test should pass

# tests 1
# passes 1

Actual Behavior

But I got output

1o
##

Note: No newline after last #

Investigation

I confirmed expected behavior with old Vim at /usr/bin/vim which is pre-installed in macOS. The version is 7.4p898 (actually patches are 1-898, 985, 8056 and I don't know what 8056 is).

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 31 2018 23:07:42)
Included patches: 1-898, 985, 8056
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
+acl             -farsi           -mouse_netterm   +syntax
-arabic          +file_in_path    -mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           -mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
+builtin_terms   -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    -keymap          +postscript      +virtualedit
+comments        -langmap         +printer         +visual
-conceal         +libcall         -profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             -rightleft       +windows
+diff            +menu            +ruby/dyn        +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
-emacs_tags      -mouseshape      -sniff           -xsmp
+eval            -mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv
THEMIS_VIM=/usr/bin/vim ./vim-themis/bin/themis foo.vimspec

So I guess this is a regression issue with grow of Vim.

I also comfirmed expected behavior with Neovim. So this issue seems to occur with recent Vim only.

Request: Support new types

Using a new type such as v:none throws the following exception.

  1) Argument Instance .get() Optional returns {default} when {expr} is not found
     function 126() abort dict  Line:1  (/private/var/folders/f_/dypbhlxd4cqg63lb40ykq0580000gn/T/vXrC8dU/1)
     function <SNR>16_eval(expr, scopes) abort  Line:11  (~/.vim/bundle/repos/github.com/thinca/vim-themis/autoload/themis/helper/command.vim)
     function <SNR>15_assert_equals(actual, expect, ...) abort  Line:1  (~/.vim/bundle/repos/github.com/thinca/vim-themis/autoload/themis/helper/assert.vim)
     function <SNR>15_equals(a, b) abort  Line:5  (~/.vim/bundle/repos/github.com/thinca/vim-themis/autoload/themis/helper/assert.vim)
     function <SNR>15_is_comparable(a, b) abort  Line:2  (~/.vim/bundle/repos/github.com/thinca/vim-themis/autoload/themis/helper/assert.vim)
     function <SNR>15_type(value) abort  Line:1  (~/.vim/bundle/repos/github.com/thinca/vim-themis/autoload/themis/helper/assert.vim)

     Vim(return):E716: Key not present in Dictionary: 7

So how about adding new types directly like (not tested):

let s:type_names = {
\   type(0): 'number',
\   type(''): 'string',
\   type(function('type')): 'funcref',
\   type([]): 'list',
\   type({}): 'dictionary',
\   type(0.0): 'float',
\ }
" The following types might not exist on old Vim
call extend(s:type_names, {
\   6: 'boolean',
\   7: 'none',
\   8: 'job',
\   9: 'channel',
\})

https://github.com/lambdalisue/vim-themis/blob/support-new-types/autoload/themis/helper/assert.vim#L366

I know that themis has several assert functions like assert_is_float() so the solution above is not enough though.

cmd.exe で実行した場合にテスト内でインサートモードに入ると表示が崩れる

cmd.exe 上で実行した場合に、特に編集作業などをしなくてもインサートモードに入ってしまうと表示が崩れてしまうようです。

次のテストスクリプトは正常に終了します

let s:suite = themis#suite('Test in cmd.exe: case1:')
let s:assert = themis#helper('assert')

function! s:suite.test() abort
  call s:assert.equals(3, 1 + 2)
endfunction

cmddotexe_case1

しかし、次のテストでは表示が崩れてしまいます。

let s:suite = themis#suite('Test in cmd.exe: case2:')
let s:assert = themis#helper('assert')

function! s:suite.test() abort
  normal! i
  call s:assert.equals(3, 1 + 2)
endfunction

実行前
cmddotexe_case2_pre
実行後
cmddotexe_case2_post

テスト自体は正しく実行されているようです。また、ほかの端末では観測していません (なので、cmd.exeの問題?)。何か使い方を間違えていたら教えてください。

Vimspec style tests fail in vim9 script

Describe the bug

Vimspec style tests fail in vim9 script.

How to reproduce the problem from Vim startup

Create test.vimspec as follows:

vim9script

Describe d
    Context c
        It should pass
            Assert Equals(3, 1 + 2)
        End
    End
End

Then run ./bin/themis test.vimspec.

$ ./bin/themis test.vimspec
Bail out!  Error occurred in script loading.                                                                                                            
# function themis/Runner.load_scripts(files_with_styles, target_bundle) abort dict  Line:11  [ Absolute Line: 130 ]  (~/vimfiles/pack/cui/start/vim-them
is/autoload/themis/runner.vim)                                                                                                                          
# function themis/style['vimspec'].load_script(filename, runner) abort dict  Line:5  [ Absolute Line: 298 ]  (~/vimfiles/pack/cui/start/vim-themis/autol
oad/themis/style/vimspec.vim)                                                                                                                           
# function script()  This function is already deleted.                                                                                                  
#   1:                                                                                                                                                  
# Vim(vim9script):E1039: "vim9script" must be the first command in a script

On the other hand, basic style tests don't fail.

vim9script

var assert = themis#helper('assert')

def MyTest()
    assert.equals(3, 1 + 2)
enddef
$ ./bin/themis test.vim
1..0                                                                                                                                                    
                                                                                                                                                        
# tests 0                                                                                                                                               
# passes 0 

Expected behavior

I expect vimspec style tests don't fail in vim9 script as well as basic style tests.

Actual behavior

See above.

Your environment

  • OS: Mac OS Monterey 12.5
  • Vim's version: 8.1.5151
  • Plugin's version: 1.7.0

Include :messages in failure output

Is your feature request related to a problem?

One of my tests is failing. The function reports possible problems using a logger that basically does echomsg. I would like to see those log statements to troubleshoot the test, but the themis command just reports that my function returned an empty list instead of my expected value.

Describe the solution you'd like

It would be nice if there was an option to include the output of :messages (with the exception of the Maintainer line at the beginning) along with the assertion errors in the reporter output for failing tests.

This could be accomplished with something like calling messages clear before each test, then capturing messages after the test with

let save_reg = getreg('m')
redir @m
silent messages
redir END
call setreg('m', save_reg)

Test the cursor position

Is there a way to test a script which relies on the cursor position with movements?

Thanks for the great work!

$THEMIS_VIM のデフォルト値を $VIM にしてほしい

themis コマンドを実行した時に起動される Vim のパスですが、$THEMIS_VIM を使用することになっており、
これの初期値が vim になっています。

Vim から themis コマンドを起動する場合もあることを考えると、この環境変数の初期値は $VIM にしたほうが良いのではないかと思っています。 $VIM が空の時、"vim" とすることで互換性を保つことができます。

いかがでしょうか。

[Request] Improved Before/After

  1. I would like to initialize and finalize the environment just before and after themis's tests which would be written to .themisrc
  2. I would like to have default Before/After for all suites.

全テストの前後で初期化・終了処理を行いたいという要望とデフォルトの Before, Before all, After, After all が欲しいという要望です。

全テストの前後で初期化・終了処理を行いたい

例えば IO などでテスト中は tempname() によるディレクトリを利用して、テストが終わったら消したいなどの場合に便利です。Before などでは インスタンス作成時 にディレクトリ構造を構築するタイプのものだと After で削除した後に期待するサブディレクトリにアクセスできずに落ちます

デフォルトの Before, After

そのままですが、バッファの初期化処理などをすべてのテストに記載するのが面倒なので .themisrc などに記載するとすべてのテストファイルに適用される、などの機能があると助かります。

call s:assert.equals(0, '') is succeeded.

Run vim script below using themis, it will be succeed.
Why?

let s:suite= themis#suite('It looks like a bug?')
let s:assert= themis#helper('assert')

function! s:suite.zero_equals_string()
    call s:assert.equals(0, '')
endfunction

I would like to use 'not_has_key' in themis

has_key の逆バージョンである not_has_key 的なものがあると便利です。

expect の場合は not があるので不要かもしれませんが assert の場合は Assert !has_key(...) とする必要があり統一感が崩れてしまいます。ご一考いただければ幸いです。

timer コールバックの呼び出し順番がひっくり返る

以下のコードを themis 経由で呼ぶか普通に :source % で実行するかで aX の順番が変わります。

try
  let s:suite = themis#suite('timer test')
  let s:assert = themis#helper('assert')
catch
  let s:suite = {}
endtry

function! s:suite.test() abort
  let rs = []
  call timer_start(0, { -> add(rs, 'a1') })
  call timer_start(0, { -> add(rs, 'a2') })
  call timer_start(0, { -> add(rs, 'a3') })
  call timer_start(0, { -> timer_start(0, { -> add(rs, 'b1') }) })
  call timer_start(0, { -> timer_start(0, { -> add(rs, 'b2') }) })
  call timer_start(0, { -> timer_start(0, { -> add(rs, 'b3') }) })
  sleep 100m
  call s:assert.equals(rs, ['a1', 'a2', 'a3', 'b1', 'b2', 'b3'])
endfunction

function! s:not_themis() abort
  let rs = []
  call timer_start(0, { -> add(rs, 'a1') })
  call timer_start(0, { -> add(rs, 'a2') })
  call timer_start(0, { -> add(rs, 'a3') })
  call timer_start(0, { -> timer_start(0, { -> add(rs, 'b1') }) })
  call timer_start(0, { -> timer_start(0, { -> add(rs, 'b2') }) })
  call timer_start(0, { -> timer_start(0, { -> add(rs, 'b3') }) })
  sleep 100m
  call themis#log(string(rs))
endfunction

call s:not_themis()
$ themis test.vim
['a3', 'a2', 'a1', 'b1', 'b2', 'b3']
1..1
not ok 1 - timer test test
# The equivalent values were expected, but it was not the case.
#
#     expected: ['a1', 'a2', 'a3', 'b1', 'b2', 'b3']
#          got: ['a3', 'a2', 'a1', 'b1', 'b2', 'b3']

# tests 1
# passes 0
# fails 1
:QuickRun

['a1', 'a2', 'a3', 'b1', 'b2', 'b3']
*** time: 0.14395 ***

Provide a message with expect

Is your feature request related to a problem?

The error message for a failing expect call doesn't provide a lot of context about which line is failing. For example, # Expected 2 to equal '1' if there are several expect calls in the test, all of which involve numbers, or perhaps when checking a property of a list of items in a loop.

Describe the solution you'd like

I'd like to specify a message as part of the expect chain, much as one can be provided with assert calls. I can think of a couple ways this could be done:

  • Optional parameter: s:expect(len(l:mylist), 'should have one element').to_equal(1)
  • Chained function calls: s:expect(len(l:mylist)).with_message('should have one element').to_equal(1)
  • Provide message as a context:
    let s:withmsg = themis#helper('with_message')
    call s:withmsg('should have one element').expect(len(l:mylist)).to_equal(1)
    " could wrap assert, too
    call s:withmsg('should be upper case').assert.match(l:mylist[0], '^[A-Z]\+l')

AppVeyor で使うバイナリを github 上のものに切り替える

今は files.kaoriya.net のものを使っていただいていますが
https://github.com/koron/vim-kaoriya/releases/latest
のものに切り替えることは可能でしょうか?
特に事故などが無い限り、正式リリースのたびに同じものをアップロードしてます。

理由はいくつかありますが
files.kaoriya.net は自前サーバのためサービスの継続性にお約束ができないことと、
また github のほうが AppVeyor とのネットワーク的な距離が近いことが期待できるのではないかなと。

古い 7.3 については別途考える必要があるとは考えています。
「ココに置くと良いのでは」みたいな提案がありましたら、お願いします。

[Request] Show which test fail in Fatal error

It would be nice if I can see which test is failed even when Fatal error occur with dot report like

FATAL ERROR: 
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................PP........................................................................................................................................................................................
Error occurred in core.
Command exited with code 1

https://ci.appveyor.com/project/vim-jp/vital-vim/build/125/job/c4jxuj42toofqkq0

It is quite difficult to figure out which test or file cause the fatal error

Show on which line assertion failed

Consider having a test like this:

let s:suite = themis#suite('my_test')
let s:assert = themis#helper('assert')

function! s:suite.test_valid() abort
  call s:assert.equals(0, 1-1)
  call s:assert.equals(2, 1+1)
  call s:assert.equals(3, 1+1)
  call s:assert.equals(4, 2+2)
  call s:assert.equals(5, 3+2)
endfunction

Output for spec reporter is this:

my_test
  [✖] test_valid
      The equivalent values were expected, but it was not the case.

          expected: 2
               got: 3

tests 1
passes 0
fails 1

There's no information which exact assertion (on which line) failed.
Same thing with other reporters.

Something like this would be great:

my_test
  [✖] test_valid
      The equivalent values were expected, but it was not the case.

          expected: 2
               got: 3
		      line: 7

tests 1
passes 0
fails 1

please tag latest master

There has been no tag since Dec 2017. For vim-lsp we explicitly use the tag to get a specific commit for vim-themis.

Backward incompatible changes were introduced from v1.5.2

状態

v1.5.1 で通るテストが v1.5.2 で落ちるようになった (vim: 7.4.1685)

原因

Vital.Vim.ScriptLocal にてスクリプトローカル変数を書き換えてテストを行っているが v1.5.2 だと書き換えが適用されていない感じ(下記が一番シンプルな関連箇所です)

上記の let sv.references['foo'] = { 'worktree': 'foo' } が適用されず、直後で call themis#log(gita#core#_get_references()) しても空辞書が表示されます( gita/core.vimgita#core#_get_references() という s:references を返す関数を追加した場合)。

必要な情報などあれば追記します ;-)

Testing coverage?

Do you think it would be possible to implement testing coverage?
Or would you know of another tool that fulfill this purpose?

Thanks for the great work!

`s:expect(0).to_be_false()` inside while loop throws E488

Thank you for your great framework.
I found an unspecified behavior as follows:

let s:suite = themis#suite('test')
let s:expect = themis#helper('expect')

function! s:suite.works_fine()
    call s:expect(0).to_be_false()
endfunction

function! s:suite.does_not_work()
    let i = 0
    let imax = 10
    while i < imax
        call s:expect(0).to_be_false()
        let i += 1
    endwhile
endfunction

Result:

% themis themis-test.vim

1..2
ok 1 - test works_fine
not ok 2 - test does_not_work
# function 102()  Line:4  (~/tmp/themis-test.vim)
# Vim(call):E488: Trailing characters

# tests 2
# passes 1
# fails 1

Environment:

  • OS X 10.10.1
  • Vim 7.4 (2013 Aug 10, compiled Dec 4 2014 19:05:45)
  • Patch: 1-527

テストにコケたときに、FATAL ERROR:とだけ表示され、詳細が表示されない

以下が表題の現象を再現させるための最小のテストスクリプトになります。

let s:suite= themis#suite('uryiiiii')

let s:dic= {}

function! s:dic.apply(list)
    let o= {'val': 'hoge'}
    function! o.test(val)
        return a:val =~# self.val
    endfunction
    return filter(copy(a:list), 'o.test(v:val)')
endfunction

function! s:suite.test()
    call s:dic.apply([{}])
endfunction

通常であれば、以下のエラーが表示されるのですが、

function 740..741, line 1
E735: Can only compare Dictionary with Dictionary

themisでのテスト時に例外が発生すると詳細が何も表示されなくなります。

1..1
------------------------------------------------------------------------------
FATAL ERROR:

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.