kana / vim-vspec

Vim plugin: Testing framework for Vim script
http://www.vim.org/scripts/script.php?script_id=3012
222 stars 13 forks source link

*.t tests can't pass, please have a look #59

Closed vfbiby closed 4 years ago

vfbiby commented 4 years ago

vim-vspec is a greate plugin about testing vimscript. I do love it, the elegant syntax is so awesome. And I am a fans of TDD, I love red-green-refactor circle. let test driven out code make me think more clearly. But I found vim-vspec can't specify a test to run. When I got errors after running a file tests. I don't know where is the error come from. So I am going to add this feature to vim-vspec. And I want to record screencasts to show how I use TDD to realize this feature. But when i cloned vim-vspec to my mac. And I running rake test, all .vim tests are pass and all .t tests failed in the t directory. I tryied two mac, One is catalina, another is Big Sur. All got the some error.

this is the errors

I run rake test in neovim terminal, I think the two output is equal, But I don't know why i got error.

WX20200910-212148@2x

I run rake test in iterm & zsh

run-in-iterm-and-zsh

this is neovim version

tnvim-version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 20 2020 22:55:15) macOS version 包含补丁: 1-1500 编译者 Homebrew

I do have try my best to solve this problem. But failed.

this is my pr to vim-test https://github.com/vim-test/vim-test/pull/514 https://github.com/vim-test/vim-test/pull/515

vfbiby commented 4 years ago
bats-run-simple-test

I use bats to run a very simple test to assert the vspec's output is equale to expected output, but failed.

kana commented 4 years ago

Would you mind running the following command and pasting its result as text?

./t/vspec-path-never-duplicated.t | od -tax1

This should print the following output:

$ ./t/vspec-path-never-duplicated.t | od -tax1
0000000   o   k  sp   1  nl   1   .   .   1  nl
         6f  6b  20  31  0a  31  2e  2e  31  0a
0000012

On your environment, you'll get something different. The actual difference seems to be invisible if it is directly printed to terminal.

vfbiby commented 4 years ago

it have so much things! kana

vim_projects/vim-vspec ‹master*› » ./t/vspec-path-never-duplicated.t | od -tax1
0000000    n   o   t  sp   o   k  sp   1  nl   #  sp   -   -   -  sp   /
           6e  6f  74  20  6f  6b  20  31  0a  23  20  2d  2d  2d  20  2f
0000020    d   e   v   /   f   d   /   6   2  ht   2   0   2   0   -   0
           64  65  76  2f  66  64  2f  36  32  09  32  30  32  30  2d  30
0000040    9   -   1   0  sp   2   3   :   3   5   :   1   5   .   0   0
           39  2d  31  30  20  32  33  3a  33  35  3a  31  35  2e  30  30
0000060    0   0   0   0   0   0   0  sp   +   0   8   0   0  nl   #  sp
           30  30  30  30  30  30  30  20  2b  30  38  30  30  0a  23  20
0000100    +   +   +  sp   /   d   e   v   /   f   d   /   6   1  ht   2
           2b  2b  2b  20  2f  64  65  76  2f  66  64  2f  36  31  09  32
0000120    0   2   0   -   0   9   -   1   0  sp   2   3   :   3   5   :
           30  32  30  2d  30  39  2d  31  30  20  32  33  3a  33  35  3a
0000140    1   5   .   0   0   0   0   0   0   0   0   0  sp   +   0   8
           31  35  2e  30  30  30  30  30  30  30  30  30  20  2b  30  38
0000160    0   0  nl   #  sp   @   @  sp   -   1   ,   2  sp   +   1   ,
           30  30  0a  23  20  40  40  20  2d  31  2c  32  20  2b  31  2c
0000200    4  sp   @   @  nl   #  sp   -   o   k  sp   1  sp   -  sp   .
           34  20  40  40  0a  23  20  2d  6f  6b  20  31  20  2d  20  2e
0000220    /   b   i   n   /   v   s   p   e   c  sp   e   x   c   l   u
           2f  62  69  6e  2f  76  73  70  65  63  20  65  78  63  6c  75
0000240    d   e   s  sp   e   x   p   l   i   c   i   t   l   y  sp   s
           64  65  73  20  65  78  70  6c  69  63  69  74  6c  79  20  73
0000260    p   e   c   i   f   i   e   d  sp   v   s   p   e   c  sp   p
           70  65  63  69  66  69  65  64  20  76  73  70  65  63  20  70
0000300    a   t   h  nl   #  sp   -   1   .   .   1  nl   #  sp   +  cr
           61  74  68  0a  23  20  2d  31  2e  2e  31  0a  23  20  2b  0d
0000320   cr  nl   #  sp   +   o   k  sp   1  sp   -  sp   .   /   b   i
           0d  0a  23  20  2b  6f  6b  20  31  20  2d  20  2e  2f  62  69
0000340    n   /   v   s   p   e   c  sp   e   x   c   l   u   d   e   s
           6e  2f  76  73  70  65  63  20  65  78  63  6c  75  64  65  73
0000360   sp   e   x   p   l   i   c   i   t   l   y  sp   s   p   e   c
           20  65  78  70  6c  69  63  69  74  6c  79  20  73  70  65  63
0000400    i   f   i   e   d  sp   v   s   p   e   c  sp   p   a   t   h
           69  66  69  65  64  20  76  73  70  65  63  20  70  61  74  68
0000420   cr  nl   #  sp   +   1   .   .   1  cr  nl   #  sp   +  cr  nl
           0d  0a  23  20  2b  31  2e  2e  31  0d  0a  23  20  2b  0d  0a
0000440    #  sp   \  sp   N   o  sp   n   e   w   l   i   n   e  sp   a
           23  20  5c  20  4e  6f  20  6e  65  77  6c  69  6e  65  20  61
0000460    t  sp   e   n   d  sp   o   f  sp   f   i   l   e  nl   1   .
           74  20  65  6e  64  20  6f  66  20  66  69  6c  65  0a  31  2e
0000500    .   1  nl
           2e  31  0a
0000503
kana commented 4 years ago

Thank you for the quick response. There are unexpected CRs in your output, and they are invisible in the screenshots. For example:

0000300    a   t   h  nl   #  sp   -   1   .   .   1  nl   #  sp   +  cr
           61  74  68  0a  23  20  2d  31  2e  2e  31  0a  23  20  2b  0d
0000320   cr  nl   #  sp   +   o   k  sp   1  sp   -  sp   .   /   b   i
           0d  0a  23  20  2b  6f  6b  20  31  20  2d  20  2e  2f  62  69

The problem seems to be caused by some command other than Vim, because I couldn't reproduce the problem with the same version of Vim you used. I'll investigate it later.

vfbiby commented 4 years ago

thank you so much. I write a simple diff test, it passed.

simple-diff-test
kana commented 4 years ago

I've pushed a fix for the problem. Please try the latest version vim-vspec.

vfbiby commented 4 years ago
all-t-tests-pass

all pass! so cool