1
0
forked from aniani/vim

patch 8.2.0969: assert_equal() output for dicts is hard to figure out

Problem:    Assert_equal() output for dicts is hard to figure out.
Solution:   Only show the different items.
This commit is contained in:
Bram Moolenaar
2020-06-13 15:13:38 +02:00
parent c9630d2658
commit 4a021dfbee
3 changed files with 99 additions and 2 deletions

View File

@@ -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])