From c11417b3d74f02568e37ea3370a7c24141d4f18a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 May 2023 12:59:43 +0800 Subject: vim-patch:9.0.1507: assert message is confusing with boolean result Problem: Assert message is confusing with boolean result. assert_inrange() replaces message instead of adding it. Solution: Don't put quotes around expected boolean value. Append message for assert_inrange(). (closes vim/vim#12342, closes vim/vim#12341) https://github.com/vim/vim/commit/53f5e51628b56ef9171671cd6e9970374036a084 Move assert_type_T to testing.c and remove ASSERT_INRANGE. --- test/old/testdir/test_assert.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_assert.vim b/test/old/testdir/test_assert.vim index 087eea3bcf..57d11d0e3a 100644 --- a/test/old/testdir/test_assert.vim +++ b/test/old/testdir/test_assert.vim @@ -9,11 +9,11 @@ func Test_assert_false() call assert_equal(0, v:false->assert_false()) call assert_equal(1, assert_false(123)) - call assert_match("Expected 'False' but got 123", v:errors[0]) + call assert_match("Expected False but got 123", v:errors[0]) call remove(v:errors, 0) call assert_equal(1, 123->assert_false()) - call assert_match("Expected 'False' but got 123", v:errors[0]) + call assert_match("Expected False but got 123", v:errors[0]) call remove(v:errors, 0) endfunc @@ -24,11 +24,11 @@ func Test_assert_true() call assert_equal(0, v:true->assert_true()) call assert_equal(1, assert_true(0)) - call assert_match("Expected 'True' but got 0", v:errors[0]) + call assert_match("Expected True but got 0", v:errors[0]) call remove(v:errors, 0) call assert_equal(1, 0->assert_true()) - call assert_match("Expected 'True' but got 0", v:errors[0]) + call assert_match("Expected True but got 0", v:errors[0]) call remove(v:errors, 0) endfunc @@ -405,8 +405,11 @@ func Test_assert_inrange() call remove(v:errors, 0) " Use a custom message + call assert_equal(1, assert_inrange(5, 7, 8, "Higher")) + call assert_match("Higher: Expected range 5 - 7, but got 8", v:errors[0]) + call remove(v:errors, 0) call assert_equal(1, assert_inrange(5, 7, 8.0, "Higher")) - call assert_match("Higher", v:errors[0]) + call assert_match("Higher: Expected range 5.0 - 7.0, but got 8.0", v:errors[0]) call remove(v:errors, 0) " Invalid arguments -- cgit