Mercurial > vim
comparison src/testdir/test_functions.vim @ 20109:e82996ad131f v8.2.0610
patch 8.2.0610: some tests are still old style
Commit: https://github.com/vim/vim/commit/08f4157c5cabc55bcb22f04dd7c717aba40caa34
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 20 16:50:00 2020 +0200
patch 8.2.0610: some tests are still old style
Problem: Some tests are still old style.
Solution: Convert to new style tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5957)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 Apr 2020 17:00:04 +0200 |
parents | c087099e9163 |
children | 16460964c304 |
comparison
equal
deleted
inserted
replaced
20108:8823765c60f2 | 20109:e82996ad131f |
---|---|
97 | 97 |
98 call assert_equal(0, len('')) | 98 call assert_equal(0, len('')) |
99 call assert_equal(2, len('ab')) | 99 call assert_equal(2, len('ab')) |
100 | 100 |
101 call assert_equal(0, len([])) | 101 call assert_equal(0, len([])) |
102 call assert_equal(0, len(test_null_list())) | |
102 call assert_equal(2, len([2, 1])) | 103 call assert_equal(2, len([2, 1])) |
103 | 104 |
104 call assert_equal(0, len({})) | 105 call assert_equal(0, len({})) |
106 call assert_equal(0, len(test_null_dict())) | |
105 call assert_equal(2, len({'a': 1, 'b': 2})) | 107 call assert_equal(2, len({'a': 1, 'b': 2})) |
106 | 108 |
107 call assert_fails('call len(v:none)', 'E701:') | 109 call assert_fails('call len(v:none)', 'E701:') |
108 call assert_fails('call len({-> 0})', 'E701:') | 110 call assert_fails('call len({-> 0})', 'E701:') |
109 endfunc | 111 endfunc |
797 split | 799 split |
798 call append(0, ["foo"]) | 800 call append(0, ["foo"]) |
799 split | 801 split |
800 only | 802 only |
801 undo | 803 undo |
804 | |
805 " Using $ instead of '$' must give an error | |
806 call assert_fails("call append($, 'foobar')", 'E116:') | |
802 endfunc | 807 endfunc |
803 | 808 |
804 func Test_getbufvar() | 809 func Test_getbufvar() |
805 let bnr = bufnr('%') | 810 let bnr = bufnr('%') |
806 let b:var_num = '1234' | 811 let b:var_num = '1234' |
2041 call assert_equal(5, len(range(0, 12, 3))) | 2046 call assert_equal(5, len(range(0, 12, 3))) |
2042 call assert_equal(4, len(range(3, 0, -1))) | 2047 call assert_equal(4, len(range(3, 0, -1))) |
2043 | 2048 |
2044 " list2str() | 2049 " list2str() |
2045 call assert_equal('ABC', list2str(range(65, 67))) | 2050 call assert_equal('ABC', list2str(range(65, 67))) |
2051 call assert_fails('let s = list2str(5)', 'E474:') | |
2046 | 2052 |
2047 " lock() | 2053 " lock() |
2048 let thelist = range(5) | 2054 let thelist = range(5) |
2049 lockvar thelist | 2055 lockvar thelist |
2050 | 2056 |
2214 call assert_equal(-1, screenattr(-1, -1)) | 2220 call assert_equal(-1, screenattr(-1, -1)) |
2215 call assert_equal(-1, screenchar(-1, -1)) | 2221 call assert_equal(-1, screenchar(-1, -1)) |
2216 call assert_equal([], screenchars(-1, -1)) | 2222 call assert_equal([], screenchars(-1, -1)) |
2217 endfunc | 2223 endfunc |
2218 | 2224 |
2225 " Test for getcurpos() and setpos() | |
2226 func Test_getcurpos_setpos() | |
2227 new | |
2228 call setline(1, ['012345678', '012345678']) | |
2229 normal gg6l | |
2230 let sp = getcurpos() | |
2231 normal 0 | |
2232 call setpos('.', sp) | |
2233 normal jyl | |
2234 call assert_equal('6', @") | |
2235 close! | |
2236 endfunc | |
2237 | |
2219 " vim: shiftwidth=2 sts=2 expandtab | 2238 " vim: shiftwidth=2 sts=2 expandtab |