annotate src/testdir/test_crypt.vim @ 17049:f38fcbf343ce v8.1.1524

patch 8.1.1524: tests are silently skipped commit https://github.com/vim/vim/commit/b0f94c1ff34d27d33aa9f96204985ea29c2eb0a1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 13 22:19:53 2019 +0200 patch 8.1.1524: tests are silently skipped Problem: Tests are silently skipped. Solution: Throw an exception for skipped tests in more places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 13 Jun 2019 22:30:07 +0200
parents 959cf4c63b18
children 8e9e9124c7a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10221
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for encryption.
10231
cbee14cc4da6 commit https://github.com/vim/vim/commit/1eceadaf481e34ed8155011534159775697ce884
Christian Brabandt <cb@256bit.org>
parents: 10225
diff changeset
2
cbee14cc4da6 commit https://github.com/vim/vim/commit/1eceadaf481e34ed8155011534159775697ce884
Christian Brabandt <cb@256bit.org>
parents: 10225
diff changeset
3 if !has('cryptv')
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15531
diff changeset
4 throw 'Skipped, encryption feature missing'
10231
cbee14cc4da6 commit https://github.com/vim/vim/commit/1eceadaf481e34ed8155011534159775697ce884
Christian Brabandt <cb@256bit.org>
parents: 10225
diff changeset
5 endif
10221
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Common_head_only(text)
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 " This was crashing Vim
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 split Xtest.txt
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call setline(1, a:text)
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 wq
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", "tx")
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call delete('Xtest.txt')
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_match('VimCrypt', getline(1))
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 bwipe!
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 func Test_head_only_2()
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call Common_head_only('VimCrypt~02!abc')
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 endfunc
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 func Test_head_only_3()
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call Common_head_only('VimCrypt~03!abc')
fb1fde4fcff7 commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endfunc
10239
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
25
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
26 func Crypt_uncrypt(method)
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
27 exe "set cryptmethod=" . a:method
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
28 " If the blowfish test fails 'cryptmethod' will be 'zip' now.
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
29 call assert_equal(a:method, &cryptmethod)
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
30
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
31 split Xtest.txt
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
32 let text = ['01234567890123456789012345678901234567',
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
33 \ 'line 2 foo bar blah',
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
34 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx']
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
35 call setline(1, text)
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
36 call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt')
15531
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
37 call assert_equal('*****', &key)
10239
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
38 w!
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
39 bwipe!
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
40 call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", 'xt')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
41 call assert_equal(text, getline(1, 3))
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
42 set key= cryptmethod&
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
43 bwipe!
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
44 call delete('Xtest.txt')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
45 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
46
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
47 func Test_crypt_zip()
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
48 call Crypt_uncrypt('zip')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
49 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
50
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
51 func Test_crypt_blowfish()
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
52 call Crypt_uncrypt('blowfish')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
53 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
54
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
55 func Test_crypt_blowfish2()
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
56 call Crypt_uncrypt('blowfish2')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
57 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
58
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
59 func Uncrypt_stable(method, crypted_text, key, uncrypted_text)
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
60 split Xtest.txt
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
61 set bin noeol key= fenc=latin1
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
62 exe "set cryptmethod=" . a:method
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
63 call setline(1, a:crypted_text)
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
64 w!
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
65 bwipe!
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
66 set nobin
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
67 call feedkeys(":split Xtest.txt\<CR>" . a:key . "\<CR>", 'xt')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
68 call assert_equal(a:uncrypted_text, getline(1, len(a:uncrypted_text)))
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
69 bwipe!
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
70 call delete('Xtest.txt')
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
71 set key=
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
72 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
73
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
74 func Test_uncrypt_zip()
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
75 call Uncrypt_stable('zip', "VimCrypt~01!\u0006\u001clV'\u00de}Mg\u00a0\u00ea\u00a3V\u00a9\u00e7\u0007E#3\u008e2U\u00e9\u0097", "foofoo", ["1234567890", "aábbccddeëff"])
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
76 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
77
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
78 func Test_uncrypt_blowfish()
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
79 call Uncrypt_stable('blowfish', "VimCrypt~02!k)\u00be\u0017\u0097#\u0016\u00ddS\u009c\u00f5=\u00ba\u00e0\u00c8#\u00a5M\u00b4\u0086J\u00c3A\u00cd\u00a5M\u00b4\u0086!\u0080\u0015\u009b\u00f5\u000f\u00e1\u00d2\u0019\u0082\u0016\u0098\u00f7\u000d\u00da", "barbar", ["asdfasdfasdf", "0001112223333"])
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
80 endfunc
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
81
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
82 func Test_uncrypt_blowfish2()
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
83 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", "!@#$%^&*()_+=-`~"])
ebbc8d21105b commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents: 10231
diff changeset
84 endfunc
15531
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
85
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
86 func Test_uncrypt_unknown_method()
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
87 split Xuncrypt_unknown.txt
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
88 set bin noeol key= fenc=latin1
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
89 call setline(1, "VimCrypt~93!\u001e\u00d1")
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
90 w!
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
91 bwipe!
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
92 set nobin
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
93 call assert_fails(":split Xuncrypt_unknown.txt", 'E821:')
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
94
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
95 bwipe!
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
96 call delete('Xuncrypt_unknown.txt')
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
97 set key=
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
98 endfunc
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
99
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
100 func Test_crypt_key_mismatch()
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
101 set cryptmethod=blowfish
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
102
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
103 split Xtest.txt
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
104 call setline(1, 'nothing')
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
105 call feedkeys(":X\<CR>foobar\<CR>nothing\<CR>", 'xt')
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
106 call assert_match("Keys don't match!", execute(':2messages'))
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
107 call assert_equal('', &key)
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
108 call feedkeys("\<CR>\<CR>", 'xt')
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
109
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
110 set cryptmethod&
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
111 bwipe!
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
112 endfunc
959cf4c63b18 patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents: 10239
diff changeset
113