diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-18 22:48:34 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-18 22:48:34 +0100 |
commit | 987411db9e4b76b524d0579db21074be0bffd61b (patch) | |
tree | 215f2c2b7c988b5572e645cbb52c73d65b6bad2a /src/testdir/test_crypt.vim | |
parent | 0314236aabcb2ca9d0b74074dadecf68d7c7ed5f (diff) |
patch 8.1.0773: not all crypt code is testedv8.1.0773
Problem: Not all crypt code is tested.
Solution: Disable unused crypt code. Add more test coverage.
Diffstat (limited to 'src/testdir/test_crypt.vim')
-rw-r--r-- | src/testdir/test_crypt.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/testdir/test_crypt.vim b/src/testdir/test_crypt.vim index 4d77a9a9bf..bf1a511118 100644 --- a/src/testdir/test_crypt.vim +++ b/src/testdir/test_crypt.vim @@ -34,6 +34,7 @@ func Crypt_uncrypt(method) \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] call setline(1, text) call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') + call assert_equal('*****', &key) w! bwipe! call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", 'xt') @@ -81,3 +82,32 @@ endfunc func Test_uncrypt_blowfish2() call Uncrypt_stable('blowfish', "VimCrypt~03!\u001e\u00d1N\u00e3;\u00d3\u00c0\u00a0^C)\u0004\u00f7\u007f.\u00b6\u00abF\u000eS\u0019\u00e0\u008b6\u00d2[T\u00cb\u00a7\u0085\u00d8\u00be9\u000b\u00812\u000bQ\u00b3\u00cc@\u0097\u000f\u00df\u009a\u00adIv\u00aa.\u00d8\u00c9\u00ee\u009e`\u00bd$\u00af%\u00d0", "barburp", ["abcdefghijklmnopqrstuvwxyz", "!@#$%^&*()_+=-`~"]) endfunc + +func Test_uncrypt_unknown_method() + split Xuncrypt_unknown.txt + set bin noeol key= fenc=latin1 + call setline(1, "VimCrypt~93!\u001e\u00d1") + w! + bwipe! + set nobin + call assert_fails(":split Xuncrypt_unknown.txt", 'E821:') + + bwipe! + call delete('Xuncrypt_unknown.txt') + set key= +endfunc + +func Test_crypt_key_mismatch() + set cryptmethod=blowfish + + split Xtest.txt + call setline(1, 'nothing') + call feedkeys(":X\<CR>foobar\<CR>nothing\<CR>", 'xt') + call assert_match("Keys don't match!", execute(':2messages')) + call assert_equal('', &key) + call feedkeys("\<CR>\<CR>", 'xt') + + set cryptmethod& + bwipe! +endfunc + |