blob: 717b66026ac7da6e276e3971b5cc79227d185420 [file] [log] [blame]
Bram Moolenaar40e6a712010-05-16 22:32:54 +02001Test for encryption.
2
3STARTTEST
4:so small.vim
Bram Moolenaarf50a2532010-05-21 15:36:08 +02005:/^start of text/+1
6:let text_lines = getline('.', line('.') + 2)
7:/^start of cm=0 bytes/+1
8:let cm0_bytes = getline('.', '.')
9:/^start of cm=1 bytes/+1
10:let cm1_bytes = getline('.', '.')
11:bwipe
12:call append(0, text_lines)
Bram Moolenaar40e6a712010-05-16 22:32:54 +020013:$d
14:X
15foobar
16foobar
17:w! Xtestfile
18:bwipe!
19:e Xtestfile
20foobar
Bram Moolenaarf50a2532010-05-21 15:36:08 +020021:let cm0_read_back = getline('.', '$')
Bram Moolenaar40e6a712010-05-16 22:32:54 +020022:set key=
23:set cryptmethod=1
Bram Moolenaarf50a2532010-05-21 15:36:08 +020024:" If the blowfish test fails 'cryptmethod' will be 0 now.
25:%s/^/\=&cryptmethod == 1 ? "OK " : "blowfish test failed "/
Bram Moolenaar40e6a712010-05-16 22:32:54 +020026:X
27barfoo
28barfoo
29:w! Xtestfile
30:bwipe!
31:e Xtestfile
32barfoo
Bram Moolenaarf50a2532010-05-21 15:36:08 +020033:let cm1_read_back = getline('.', '$')
34:bwipe!
35:set bin noeol key=
36:call append(0, cm0_bytes)
37:$d
38:set fenc=latin1
39:w! Xtestfile
40:bwipe!
41:set nobin
42:e Xtestfile
43foofoo
44:let cm0_read_bin = getline('.', '$')
45:bwipe!
46:set bin noeol key=
47:call append(0, cm1_bytes)
48:$d
49:set fenc=latin1
50:w! Xtestfile
51:bwipe!
52:set nobin
53:e Xtestfile
54barbar
55:call append(0, cm0_read_bin)
56:call append(0, cm1_read_back)
57:call append(0, cm0_read_back)
58:set key= fenc=latin1
Bram Moolenaar40e6a712010-05-16 22:32:54 +020059:w! test.out
60:qa!
61ENDTEST
62
Bram Moolenaarf50a2532010-05-21 15:36:08 +020063start of text
Bram Moolenaar40e6a712010-05-16 22:32:54 +02006401234567890123456789012345678901234567
65line 2 foo bar blah
66line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bram Moolenaarf50a2532010-05-21 15:36:08 +020067end of text
68
69start of cm=0 bytes
70VimCrypt~01!lV'Þ}Mg ê£V©çE#3Ž2Ué—
71end of cm=0 bytes
72
73start of cm=1 bytes
74VimCrypt~02!¨Ò9ZšÙ¢èì”F¼èÃ[,ì”F¼ƒ€z¼Ö軂 y¾Ô(
75end of cm=1 bytes