blob: 155fd413bca173f28a2fe943d62643c9a7af19ac [file] [log] [blame]
Bram Moolenaar40e6a712010-05-16 22:32:54 +02001Test for encryption.
Bram Moolenaar72fe56f2013-07-01 21:00:35 +02002The test data is in another file to avoid problems with 'encoding', especially
3cp932.
Bram Moolenaar40e6a712010-05-16 22:32:54 +02004
5STARTTEST
6:so small.vim
Bram Moolenaar72fe56f2013-07-01 21:00:35 +02007:set enc=latin1
8:bwipe!
9:r test71a.in
Bram Moolenaarf50a2532010-05-21 15:36:08 +020010:/^start of text/+1
11:let text_lines = getline('.', line('.') + 2)
Bram Moolenaar49771f42010-07-20 17:32:38 +020012:/^start of cm=zip bytes/+1
Bram Moolenaarf50a2532010-05-21 15:36:08 +020013:let cm0_bytes = getline('.', '.')
Bram Moolenaar49771f42010-07-20 17:32:38 +020014:/^start of cm=blowfish bytes/+1
Bram Moolenaarf50a2532010-05-21 15:36:08 +020015:let cm1_bytes = getline('.', '.')
Bram Moolenaard73895e2013-06-19 21:17:31 +020016:bwipe!
Bram Moolenaarf50a2532010-05-21 15:36:08 +020017:call append(0, text_lines)
Bram Moolenaar40e6a712010-05-16 22:32:54 +020018:$d
19:X
20foobar
21foobar
22:w! Xtestfile
23:bwipe!
24:e Xtestfile
25foobar
Bram Moolenaarf50a2532010-05-21 15:36:08 +020026:let cm0_read_back = getline('.', '$')
Bram Moolenaar40e6a712010-05-16 22:32:54 +020027:set key=
Bram Moolenaar49771f42010-07-20 17:32:38 +020028:set cryptmethod=blowfish
29:" If the blowfish test fails 'cryptmethod' will be 'zip' now.
30:%s/^/\=&cryptmethod == 'blowfish' ? "OK " : "blowfish test failed "/
Bram Moolenaar40e6a712010-05-16 22:32:54 +020031:X
32barfoo
33barfoo
34:w! Xtestfile
35:bwipe!
36:e Xtestfile
37barfoo
Bram Moolenaarf50a2532010-05-21 15:36:08 +020038:let cm1_read_back = getline('.', '$')
39:bwipe!
40:set bin noeol key=
41:call append(0, cm0_bytes)
42:$d
43:set fenc=latin1
44:w! Xtestfile
45:bwipe!
46:set nobin
47:e Xtestfile
48foofoo
49:let cm0_read_bin = getline('.', '$')
50:bwipe!
51:set bin noeol key=
52:call append(0, cm1_bytes)
53:$d
54:set fenc=latin1
55:w! Xtestfile
56:bwipe!
57:set nobin
58:e Xtestfile
59barbar
60:call append(0, cm0_read_bin)
61:call append(0, cm1_read_back)
62:call append(0, cm0_read_back)
63:set key= fenc=latin1
Bram Moolenaar40e6a712010-05-16 22:32:54 +020064:w! test.out
65:qa!
66ENDTEST
67