summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_assert.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-04 18:58:22 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-04 18:58:22 +0100
commit53f5e51628b56ef9171671cd6e9970374036a084 (patch)
tree4b5887de0f113c5428cac768fa99660afa0d9898 /src/testdir/test_assert.vim
parent88bb3e0a48f160134bdea98cd2b8bd3af86f9d6f (diff)
patch 9.0.1507: assert message is confusing with boolean resultv9.0.1507
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 #12342, closes #12341)
Diffstat (limited to 'src/testdir/test_assert.vim')
-rw-r--r--src/testdir/test_assert.vim13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim
index ecf5024fdb..b7530bf1b9 100644
--- a/src/testdir/test_assert.vim
+++ b/src/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
@@ -416,8 +416,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