commit a553b3687668d055e4c2703fce2aea3ae1140374
parent 42829bf5d7df2102345f3c7597eda5da076bab9e
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue, 16 Jul 2024 11:44:17 +0800
vim-patch:7.4.1565 (#29734)
Problem: Crash when assert_equal() runs into a NULL string.
Solution: Check for NULL. (Dominique) Add a test.
https://github.com/vim/vim/commit/f1551964448607f8222de2d8f0992ea43eb2fe67
Use the latest version of the test from Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/test/old/testdir/test_assert.vim b/test/old/testdir/test_assert.vim
@@ -189,6 +189,22 @@ func Test_wrong_error_type()
call assert_equal(type([]), type(verrors))
endfunc
+func Test_compare_fail()
+ let s:v = {}
+ let s:x = {"a": s:v}
+ let s:v["b"] = s:x
+ let s:w = {"c": s:x, "d": ''}
+ try
+ call assert_equal(s:w, '')
+ catch
+ call assert_equal(0, assert_exception('E724:'))
+ " Nvim: expected value isn't shown as NULL
+ " call assert_match("Expected NULL but got ''", v:errors[0])
+ call assert_match("Expected .* but got ''", v:errors[0])
+ call remove(v:errors, 0)
+ endtry
+endfunc
+
func Test_match()
call assert_equal(0, assert_match('^f.*b.*r$', 'foobar'))