Mercurial > vim
diff src/testdir/test_assert.vim @ 7277:6600871bb38c v7.4.944
commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 29 17:35:35 2015 +0100
patch 7.4.944
Problem: Writing tests for Vim script is hard.
Solution: Add assertEqual(), assertFalse() and assertTrue() functions. Add
the v:errors variable. Add the runtest script. Add a first new
style test script.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 Nov 2015 17:45:04 +0100 |
parents | |
children | b5e9810b389d |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/src/testdir/test_assert.vim @@ -0,0 +1,19 @@ +" Test that the methods used for testing work. + +func Test_assertFalse() + call assertFalse(0) +endfunc + +func Test_assertTrue() + call assertTrue(1) + call assertTrue(123) +endfunc + +func Test_assertEqual() + let s = 'foo' + call assertEqual('foo', s) + let n = 4 + call assertEqual(4, n) + let l = [1, 2, 3] + call assertEqual([1, 2, 3], l) +endfunc