aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_assert.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-13 09:38:15 +0800
committerGitHub <noreply@github.com>2022-07-13 09:38:15 +0800
commit778541067a2f0ec3ef4bc1b07def646323e852a9 (patch)
tree1f61817823fedffd3944d5aecdec3ab561f0adf6 /src/nvim/testdir/test_assert.vim
parentc01690b1eaa4ad55cea3ec48a0b5381180ebe970 (diff)
downloadrneovim-778541067a2f0ec3ef4bc1b07def646323e852a9.tar.gz
rneovim-778541067a2f0ec3ef4bc1b07def646323e852a9.tar.bz2
rneovim-778541067a2f0ec3ef4bc1b07def646323e852a9.zip
vim-patch:8.2.0969: assert_equal() output for dicts is hard to figure out (#19317)
Problem: Assert_equal() output for dicts is hard to figure out. Solution: Only show the different items. https://github.com/vim/vim/commit/4a021dfbeee88ac09d07e257912485314ecdcabe
Diffstat (limited to 'src/nvim/testdir/test_assert.vim')
-rw-r--r--src/nvim/testdir/test_assert.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_assert.vim b/src/nvim/testdir/test_assert.vim
index 9d0d5b3e70..fdd8b0bef6 100644
--- a/src/nvim/testdir/test_assert.vim
+++ b/src/nvim/testdir/test_assert.vim
@@ -50,6 +50,26 @@ func Test_assert_equal()
call remove(v:errors, 0)
endfunc
+func Test_assert_equal_dict()
+ call assert_equal(0, assert_equal(#{one: 1, two: 2}, #{two: 2, one: 1}))
+
+ call assert_equal(1, assert_equal(#{one: 1, two: 2}, #{two: 2, one: 3}))
+ call assert_match("Expected {'one': 1} but got {'one': 3} - 1 equal item omitted", v:errors[0])
+ call remove(v:errors, 0)
+
+ call assert_equal(1, assert_equal(#{one: 1, two: 2}, #{two: 22, one: 11}))
+ call assert_match("Expected {'one': 1, 'two': 2} but got {'one': 11, 'two': 22}", v:errors[0])
+ call remove(v:errors, 0)
+
+ call assert_equal(1, assert_equal(#{}, #{two: 2, one: 1}))
+ call assert_match("Expected {} but got {'one': 1, 'two': 2}", v:errors[0])
+ call remove(v:errors, 0)
+
+ call assert_equal(1, assert_equal(#{two: 2, one: 1}, #{}))
+ call assert_match("Expected {'one': 1, 'two': 2} but got {}", v:errors[0])
+ call remove(v:errors, 0)
+endfunc
+
func Test_assert_equalfile()
call assert_equal(1, assert_equalfile('abcabc', 'xyzxyz'))
call assert_match("E485: Can't read file abcabc", v:errors[0])