diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-03 06:50:11 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-09-03 09:01:08 +0800 |
commit | 05b49ef975664ccdfea4e7b5a0fc09c8ed2cf11a (patch) | |
tree | 027519fb6db03139ca82b33256f5dd30fe9de0d7 /src/nvim/testdir/test_eval_stuff.vim | |
parent | 1ffd527c837fb2465c9659273bbe5447a1352db2 (diff) | |
download | rneovim-05b49ef975664ccdfea4e7b5a0fc09c8ed2cf11a.tar.gz rneovim-05b49ef975664ccdfea4e7b5a0fc09c8ed2cf11a.tar.bz2 rneovim-05b49ef975664ccdfea4e7b5a0fc09c8ed2cf11a.zip |
vim-patch:8.2.1505: not all file read and writecode is tested
Problem: Not all file read and writecode is tested.
Solution: Add a few tests. (Dominique Pellé, closes vim/vim#6764)
https://github.com/vim/vim/commit/1b04ce2d400fda97410a961288c496bd8f445a9c
Cherry-pick Test_glob() from patch 8.2.0634.
Diffstat (limited to 'src/nvim/testdir/test_eval_stuff.vim')
-rw-r--r-- | src/nvim/testdir/test_eval_stuff.vim | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim index eff1376d3c..351120bf11 100644 --- a/src/nvim/testdir/test_eval_stuff.vim +++ b/src/nvim/testdir/test_eval_stuff.vim @@ -91,18 +91,31 @@ func Test_readfile_binary() new call setline(1, ['one', 'two', 'three']) setlocal ff=dos - silent write XReadfile - let lines = readfile('XReadfile') + silent write XReadfile_bin + let lines = 'XReadfile_bin'->readfile() call assert_equal(['one', 'two', 'three'], lines) - let lines = readfile('XReadfile', '', 2) + let lines = readfile('XReadfile_bin', '', 2) call assert_equal(['one', 'two'], lines) - let lines = readfile('XReadfile', 'b') + let lines = readfile('XReadfile_bin', 'b') call assert_equal(["one\r", "two\r", "three\r", ""], lines) - let lines = readfile('XReadfile', 'b', 2) + let lines = readfile('XReadfile_bin', 'b', 2) call assert_equal(["one\r", "two\r"], lines) bwipe! - call delete('XReadfile') + call delete('XReadfile_bin') +endfunc + +func Test_readfile_bom() + call writefile(["\ufeffFOO", "FOO\ufeffBAR"], 'XReadfile_bom') + call assert_equal(['FOO', 'FOOBAR'], readfile('XReadfile_bom')) + call delete('XReadfile_bom') +endfunc + +func Test_readfile_max() + call writefile(range(1, 4), 'XReadfile_max') + call assert_equal(['1', '2'], readfile('XReadfile_max', '', 2)) + call assert_equal(['3', '4'], readfile('XReadfile_max', '', -2)) + call delete('XReadfile_max') endfunc func Test_let_errmsg() |