Mercurial > vim
diff src/testdir/test_crypt.vim @ 32503:5d07e7e9580f v9.0.1583
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Commit: https://github.com/vim/vim/commit/3a2a60ce4a8e73594bca16814672fcc243d093ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 27 18:02:55 2023 +0100
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Problem: Get E304 when using 'cryptmethod' "xchacha20v2". (Steve Mynott)
Solution: Add 4th crypt method to block zero ID check. Avoid syncing a swap
file before reading the file. (closes #12433)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 May 2023 19:15:04 +0200 |
parents | 6761c71f4b25 |
children | 448aef880252 |
line wrap: on
line diff
--- a/src/testdir/test_crypt.vim +++ b/src/testdir/test_crypt.vim @@ -1,5 +1,6 @@ " Tests for encryption. +source shared.vim source check.vim CheckFeature cryptv @@ -88,6 +89,29 @@ func Test_crypt_sodium_v2() call Crypt_uncrypt('xchacha20v2') endfunc +func Test_crypt_sodium_v2_startup() + CheckFeature sodium + CheckRunVimInTerminal + + let buf = RunVimInTerminal('--cmd "set cm=xchacha20v2" -x Xfoo', #{wait_for_ruler: 0, rows: 6}) + call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50) + call term_sendkeys(buf, "foo\<CR>foo\<CR>") + call term_sendkeys(buf, "ifoo\<Esc>") + call term_sendkeys(buf, "ZZ") + call TermWait(buf) + + " Wait for Vim to write the file and exit. Then wipe out the terminal buffer. + call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))}) + exe buf .. 'bwipe!' + call assert_true(filereadable('Xfoo')) + + let buf = RunVimInTerminal('--cmd "set ch=3 cm=xchacha20v2 key=foo" Xfoo', #{rows: 10}) + call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50) + call StopVimInTerminal(buf) + + call delete('Xfoo') +endfunc + func Uncrypt_stable(method, crypted_text, key, uncrypted_text) split Xtest.txt set bin noeol key= fenc=latin1