diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-19 15:18:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-19 15:18:33 -0500 |
commit | 7e4c912565f1dc00a873cff14ca435af9796cd4c (patch) | |
tree | ea1a4d1e0e4e62b361cdaaf19f6e45512b89e781 /src/nvim/testdir | |
parent | f12bbf62cc2d39d99e700029dfa61b39ea8e8746 (diff) | |
parent | fb0ecf9e70872bc43399f961f0235fbf67d19966 (diff) | |
download | rneovim-7e4c912565f1dc00a873cff14ca435af9796cd4c.tar.gz rneovim-7e4c912565f1dc00a873cff14ca435af9796cd4c.tar.bz2 rneovim-7e4c912565f1dc00a873cff14ca435af9796cd4c.zip |
Merge pull request #13559 from janlazo/vim-8.2.0162
vim-patch:8.1.1657,8.2.{162,262,264,272}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_fileformat.vim | 23 | ||||
-rw-r--r-- | src/nvim/testdir/test_help.vim | 46 |
2 files changed, 69 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_fileformat.vim b/src/nvim/testdir/test_fileformat.vim index 8dc25f62b1..465613f1cf 100644 --- a/src/nvim/testdir/test_fileformat.vim +++ b/src/nvim/testdir/test_fileformat.vim @@ -31,3 +31,26 @@ func Test_fileformat_autocommand() au! BufReadPre Xfile bw! endfunc + +" Test for changing the fileformat using ++read +func Test_fileformat_plusplus_read() + new + call setline(1, ['one', 'two', 'three']) + w ++ff=dos Xfile1 + enew! + set ff=unix + " A :read doesn't change the fileformat, but does apply to the read lines. + r ++fileformat=unix Xfile1 + call assert_equal('unix', &fileformat) + call assert_equal("three\r", getline('$')) + 3r ++edit Xfile1 + call assert_equal('dos', &fileformat) + close! + call delete('Xfile1') + set fileformat& + call assert_fails('e ++fileformat Xfile1', 'E474:') + call assert_fails('e ++ff=abc Xfile1', 'E474:') + call assert_fails('e ++abc1 Xfile1', 'E474:') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_help.vim b/src/nvim/testdir/test_help.vim index 01fb9917e9..8e59efd22d 100644 --- a/src/nvim/testdir/test_help.vim +++ b/src/nvim/testdir/test_help.vim @@ -56,3 +56,49 @@ func Test_help_local_additions() call delete('Xruntime', 'rf') let &rtp = rtp_save endfunc + +" Test for the :helptags command +func Test_helptag_cmd() + call mkdir('Xdir/a/doc', 'p') + + " No help file to process in the directory + call assert_fails('helptags Xdir', 'E151:') + + call writefile([], 'Xdir/a/doc/sample.txt') + + " Test for ++t argument + helptags ++t Xdir + call assert_equal(["help-tags\ttags\t1"], readfile('Xdir/tags')) + call delete('Xdir/tags') + + " The following tests fail on FreeBSD for some reason + if has('unix') && !has('bsd') + " Read-only tags file + call mkdir('Xdir/doc', 'p') + call writefile([''], 'Xdir/doc/tags') + call writefile([], 'Xdir/doc/sample.txt') + call setfperm('Xdir/doc/tags', 'r-xr--r--') + call assert_fails('helptags Xdir/doc', 'E152:', getfperm('Xdir/doc/tags')) + + let rtp = &rtp + let &rtp = 'Xdir' + helptags ALL + let &rtp = rtp + + call delete('Xdir/doc/tags') + + " No permission to read the help file + call setfperm('Xdir/a/doc/sample.txt', '-w-------') + call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/a/doc/sample.txt')) + call delete('Xdir/a/doc/sample.txt') + call delete('Xdir/tags') + endif + + " Duplicate tags in the help file + call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xdir/a/doc/sample.txt') + call assert_fails('helptags Xdir', 'E154:') + + call delete('Xdir', 'rf') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab |