使用Vader测试逃犯插件

时间:2019-04-24 14:28:52

标签: vim automated-tests vim-fugitive

我正在尝试测试vim-fugitive plugin。我想验证在状态窗口中的文件上按Enter键可以打开该文件。

这是test/Gstatus.vader文件:

Execute (Hstatus with added file):
  edit autoload/fugitive.vim
  Git clone . vader-clone
  cd vader-clone
  silent !cp autoload/fugitive.vim foo
  edit foo
  Git add foo
  Gstatus
  let current_filetype = execute('set ft')
  AssertNotEqual -1, match(current_filetype, 'filetype=fugitive')

Expect (added file):
  Head: 066857d8488

  Staged (1)
  A foo

Do (select file):
  /foo
  <CR>

Then(we are in new file):
  AssertEqual expand('%'), 'foo'


Execute (cleanup):
  cd ..
  !rm -rf vader-clone
  pwd

Expect (success):

但是,断言失败。以下是完整结果:

Starting Vader: 1 suite(s), 3 case(s)
  Starting Vader: /Users/stephenrasku/.vim/bundle/vim-fugitive/test/Gstatus.vader
    (1/3) [EXECUTE] Hstatus with added file
    (1/3) [ EXPECT] added file
    (2/3) [     DO] select file
    (2/3) [   THEN] we are in new file
    (2/3) [   THEN] (X) 'foo' should be equal to '[Vader-workbench]'
    (3/3) [EXECUTE] cleanup
    (3/3) [ EXPECT] success
  Success/Total: 2/3
Success/Total: 2/3 (assertions: 1/2)
Elapsed time: 5.131569 sec.

这是否是可测试的情况?

0 个答案:

没有答案