aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-05 12:36:47 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-05-05 19:43:13 +0800
commit5fb6b3431a52932dcc50bcc930f8b2c9b71a1bb0 (patch)
treef6b7010d0d237c7f684f80fa56ae4a17872f9965 /test
parent17c8e39f8803daa6f0e6106ce1c087240cef4771 (diff)
downloadrneovim-5fb6b3431a52932dcc50bcc930f8b2c9b71a1bb0.tar.gz
rneovim-5fb6b3431a52932dcc50bcc930f8b2c9b71a1bb0.tar.bz2
rneovim-5fb6b3431a52932dcc50bcc930f8b2c9b71a1bb0.zip
vim-patch:9.0.0404: crash when passing invalid arguments to assert_fails()
Problem: Crash when passing invalid arguments to assert_fails(). Solution: Check for NULL string. https://github.com/vim/vim/commit/1540d334a04d874c2aa9d26b82dbbcd4bc5a78de Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_assert.vim19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/old/testdir/test_assert.vim b/test/old/testdir/test_assert.vim
index 27f0491634..6926d73af1 100644
--- a/test/old/testdir/test_assert.vim
+++ b/test/old/testdir/test_assert.vim
@@ -265,6 +265,21 @@ func Test_assert_fail_fails()
call assert_match("E1222: String or List required for argument 2", exp)
try
+ call assert_equal(0, assert_fails('xxx', [#{one: 1}]))
+ catch
+ let exp = v:exception
+ endtry
+ call assert_match("E731: Using a Dictionary as a String", exp)
+
+ let exp = ''
+ try
+ call assert_equal(0, assert_fails('xxx', ['E492', #{one: 1}]))
+ catch
+ let exp = v:exception
+ endtry
+ call assert_match("E731: Using a Dictionary as a String", exp)
+
+ try
call assert_equal(1, assert_fails('xxx', 'E492', '', 'burp'))
catch
let exp = v:exception
@@ -278,8 +293,8 @@ func Test_assert_fail_fails()
endtry
call assert_match("E1174: String required for argument 5", exp)
- call assert_equal(1, assert_fails('c0', ['', '\1']))
- call assert_match("Expected '\\\\\\\\1' but got 'E939: Positive count required: c0': c0", v:errors[0])
+ call assert_equal(1, assert_fails('c0', ['', '\(.\)\1']))
+ call assert_match("Expected '\\\\\\\\(.\\\\\\\\)\\\\\\\\1' but got 'E939: Positive count required: c0': c0", v:errors[0])
call remove(v:errors, 0)
endfunc