diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-07 08:02:04 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-08 10:25:12 -0400 |
commit | de16b6dc7a61f2f0726537dfaa0c9a8061c7e563 (patch) | |
tree | ef94a077bfa86747cff06eae716817a9842822ca | |
parent | b398b1eeddb2118e5e00e2341d80626496488021 (diff) | |
download | rneovim-de16b6dc7a61f2f0726537dfaa0c9a8061c7e563.tar.gz rneovim-de16b6dc7a61f2f0726537dfaa0c9a8061c7e563.tar.bz2 rneovim-de16b6dc7a61f2f0726537dfaa0c9a8061c7e563.zip |
vim-patch:8.1.0406: several command line arguments are not tested
Problem: Several command line arguments are not tested.
Solution: Add tests for -A, -F, -H, -p and -V. (Dominique Pelle,
closes vim/vim#3446)
https://github.com/vim/vim/commit/9e81db9742a35cc972ce5cae204e837093987692
-rw-r--r-- | src/nvim/testdir/test_startup.vim | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 3bc9eaf756..c86c62711f 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -201,7 +201,7 @@ func Test_o_arg() " - both windows should have the same height " - window height (+ 2 for the statusline and Ex command) should be equal " to the number of lines - " - buffer of both windowns should have no name + " - buffer of both windows should have no name let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout') call assert_equal('2', wn) call assert_inrange(0, 1, ww1 - ww2) @@ -227,6 +227,69 @@ func Test_o_arg() call delete('Xtestout') endfunc +" Test the -p[N] argument to open N tabpages. +func Test_p_arg() + let after = [ + \ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")', + \ 'qall', + \ ] + if RunVim([], after, '-p2') + let lines = readfile('Xtestout') + call assert_equal(4, len(lines)) + call assert_equal('Tab page 1', lines[0]) + call assert_equal('> [No Name]', lines[1]) + call assert_equal('Tab page 2', lines[2]) + call assert_equal(' [No Name]', lines[3]) + endif + + if RunVim([], after, '-p foo bar') + let lines = readfile('Xtestout') + call assert_equal(4, len(lines)) + call assert_equal('Tab page 1', lines[0]) + call assert_equal('> foo', lines[1]) + call assert_equal('Tab page 2', lines[2]) + call assert_equal(' bar', lines[3]) + endif + + call delete('Xtestout') +endfunc + +" Test the -V[N] argument to set the 'version' option to [N] +func Test_V_arg() + let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq') + call assert_equal(" verbose=0\n", out) + + let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq') + call assert_match("^sourcing \"$VIMRUNTIME/defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n verbose=2\n$", out) + + let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq') + call assert_match("\+*\nsourcing \"$VIMRUNTIME/defaults\.vim\"\r\nline 1: \" The default vimrc file\..*\n verbose=15\n\+*", out) +endfunc + +" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes). +func Test_A_F_H_arg() + let after = [ + \ 'call writefile([&rightleft, &arabic, 0, &hkmap], "Xtestout")', + \ 'qall', + \ ] + if has('arabic') && RunVim([], after, '-A') + let lines = readfile('Xtestout') + call assert_equal(['1', '1', '0', '0'], lines) + endif + + if has('farsi') && RunVim([], after, '-F') + let lines = readfile('Xtestout') + call assert_equal(['1', '0', '1', '0'], lines) + endif + + if has('rightleft') && RunVim([], after, '-H') + let lines = readfile('Xtestout') + call assert_equal(['1', '0', '0', '1'], lines) + endif + + call delete('Xtestout') +endfunc + func Test_file_args() let after = [ \ 'call writefile(argv(), "Xtestout")', |