summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-05-21 15:36:08 +0200
committerBram Moolenaar <Bram@vim.org>2010-05-21 15:36:08 +0200
commitf50a2533d0e1dfc4c402d44fc387e0efa41f0ec4 (patch)
treeb49f3094f8f8ff8425ba7b2717af33d841299843 /src/testdir
parent6019078ece008a53d6c4abfd822eeaf29b241b2d (diff)
downloadvim-git-f50a2533d0e1dfc4c402d44fc387e0efa41f0ec4.tar.gz
A few more changes for encryption. Add test that encrypted file can be read.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test71.in56
-rw-r--r--src/testdir/test71.ok10
2 files changed, 54 insertions, 12 deletions
diff --git a/src/testdir/test71.in b/src/testdir/test71.in
index a2eadd3c1..717b66026 100644
--- a/src/testdir/test71.in
+++ b/src/testdir/test71.in
@@ -2,10 +2,14 @@ Test for encryption.
STARTTEST
:so small.vim
-:/^start of testfile/+1
-:let lines = getline('.', '$')
-:new
-:call append(0, lines)
+:/^start of text/+1
+:let text_lines = getline('.', line('.') + 2)
+:/^start of cm=0 bytes/+1
+:let cm0_bytes = getline('.', '.')
+:/^start of cm=1 bytes/+1
+:let cm1_bytes = getline('.', '.')
+:bwipe
+:call append(0, text_lines)
:$d
:X
foobar
@@ -14,10 +18,11 @@ foobar
:bwipe!
:e Xtestfile
foobar
-:let dec1_lines = getline('.', '$')
-:%s/^/2/
+:let cm0_read_back = getline('.', '$')
:set key=
:set cryptmethod=1
+:" If the blowfish test fails 'cryptmethod' will be 0 now.
+:%s/^/\=&cryptmethod == 1 ? "OK " : "blowfish test failed "/
:X
barfoo
barfoo
@@ -25,13 +30,46 @@ barfoo
:bwipe!
:e Xtestfile
barfoo
-:call append(0, dec1_lines)
-:set key=
+:let cm1_read_back = getline('.', '$')
+:bwipe!
+:set bin noeol key=
+:call append(0, cm0_bytes)
+:$d
+:set fenc=latin1
+:w! Xtestfile
+:bwipe!
+:set nobin
+:e Xtestfile
+foofoo
+:let cm0_read_bin = getline('.', '$')
+:bwipe!
+:set bin noeol key=
+:call append(0, cm1_bytes)
+:$d
+:set fenc=latin1
+:w! Xtestfile
+:bwipe!
+:set nobin
+:e Xtestfile
+barbar
+:call append(0, cm0_read_bin)
+:call append(0, cm1_read_back)
+:call append(0, cm0_read_back)
+:set key= fenc=latin1
:w! test.out
:qa!
ENDTEST
-start of testfile
+start of text
01234567890123456789012345678901234567
line 2 foo bar blah
line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+end of text
+
+start of cm=0 bytes
+VimCrypt~01!lV'Þ}Mg ê£V©çE#3Ž2Ué—
+end of cm=0 bytes
+
+start of cm=1 bytes
+VimCrypt~02!¨Ò9ZšÙ¢èì”F¼èÃ[,ì”F¼ƒ€z¼Ö軂 y¾Ô(
+end of cm=1 bytes
diff --git a/src/testdir/test71.ok b/src/testdir/test71.ok
index 5820892b6..24652c438 100644
--- a/src/testdir/test71.ok
+++ b/src/testdir/test71.ok
@@ -1,6 +1,10 @@
01234567890123456789012345678901234567
line 2 foo bar blah
line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-201234567890123456789012345678901234567
-2line 2 foo bar blah
-2line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+OK 01234567890123456789012345678901234567
+OK line 2 foo bar blah
+OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+1234567890
+aábbccddeëff
+asdfasdfasdf
+0001112223333