Mercurial > vim
annotate src/testdir/test_crypt.vim @ 20445:9f34aae7f69d v8.2.0777
patch 8.2.0777: terminal test fails
Commit: https://github.com/vim/vim/commit/79ea680e6b1dd02035fdf8a5521927cf1f98c2ed
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 17 15:09:27 2020 +0200
patch 8.2.0777: terminal test fails
Problem: Terminal test fails.
Solution: Adjust character position for double-wide characters.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 May 2020 15:15:04 +0200 |
parents | b582eb6ef192 |
children | 08940efa6b4e |
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 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature cryptv |
10221
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Common_head_only(text) |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " This was crashing Vim |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 split Xtest.txt |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call setline(1, a:text) |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 wq |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 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
|
12 call delete('Xtest.txt') |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_match('VimCrypt', getline(1)) |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 bwipe! |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunc |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 func Test_head_only_2() |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call Common_head_only('VimCrypt~02!abc') |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunc |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 func Test_head_only_3() |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call Common_head_only('VimCrypt~03!abc') |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 endfunc |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
24 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
25 func Crypt_uncrypt(method) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
26 exe "set cryptmethod=" . a:method |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
27 " 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
|
28 call assert_equal(a:method, &cryptmethod) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
29 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
30 split Xtest.txt |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
31 let text = ['01234567890123456789012345678901234567', |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
32 \ 'line 2 foo bar blah', |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
33 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
34 call setline(1, text) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
35 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
|
36 call assert_equal('*****', &key) |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
37 w! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
38 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
39 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
|
40 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
|
41 set key= cryptmethod& |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
42 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
43 call delete('Xtest.txt') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
44 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
45 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
46 func Test_crypt_zip() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
47 call Crypt_uncrypt('zip') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
48 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
49 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
50 func Test_crypt_blowfish() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
51 call Crypt_uncrypt('blowfish') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
52 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
53 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
54 func Test_crypt_blowfish2() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
55 call Crypt_uncrypt('blowfish2') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
56 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
57 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
58 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
|
59 split Xtest.txt |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
60 set bin noeol key= fenc=latin1 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
61 exe "set cryptmethod=" . a:method |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
62 call setline(1, a:crypted_text) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
63 w! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
64 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
65 set nobin |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
66 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
|
67 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
|
68 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
69 call delete('Xtest.txt') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
70 set key= |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
71 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
72 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
73 func Test_uncrypt_zip() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
74 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
|
75 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
76 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
77 func Test_uncrypt_blowfish() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
78 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
|
79 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
80 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
81 func Test_uncrypt_blowfish2() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
82 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
|
83 endfunc |
15531
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
84 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
85 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
|
86 split Xuncrypt_unknown.txt |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
87 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
|
88 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
|
89 w! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
90 bwipe! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
91 set nobin |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
92 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
|
93 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
94 bwipe! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
95 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
|
96 set key= |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
97 endfunc |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
98 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
99 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
|
100 set cryptmethod=blowfish |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
101 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
102 split Xtest.txt |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
103 call setline(1, 'nothing') |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
104 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
|
105 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
|
106 call assert_equal('', &key) |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
107 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
|
108 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
109 set cryptmethod& |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
110 bwipe! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
111 endfunc |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
112 |
20415
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
113 func Test_crypt_set_key_changes_buffer() |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
114 |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
115 new Xtest1.txt |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
116 call setline(1, 'nothing') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
117 set cryptmethod=blowfish2 |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
118 call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
119 call assert_fails(":q", "E37:") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
120 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
121 set key=anotherkey |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
122 call assert_fails(":bw") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
123 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
124 call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
125 call assert_fails(":bw") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
126 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
127 let winnr = winnr() |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
128 wincmd p |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
129 call setwinvar(winnr, '&key', 'yetanotherkey') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
130 wincmd p |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
131 call assert_fails(":bw") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
132 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
133 |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
134 set cryptmethod& |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
135 set key= |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
136 bwipe! |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
137 call delete('Xtest1.txt') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
138 endfunc |