Mercurial > vim
comparison src/testdir/test_assert.vim @ 20834:9a624c1672a3 v8.2.0969
patch 8.2.0969: assert_equal() output for dicts is hard to figure out
Commit: https://github.com/vim/vim/commit/4a021dfbeee88ac09d07e257912485314ecdcabe
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 13 15:13:38 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jun 2020 15:15:04 +0200 |
parents | b9a6a129b94e |
children | 7833afe1c66e |
comparison
equal
deleted
inserted
replaced
20833:ca13ee9c6f8a | 20834:9a624c1672a3 |
---|---|
45 call assert_match("Expected 'bar' but got 'foo'", v:errors[0]) | 45 call assert_match("Expected 'bar' but got 'foo'", v:errors[0]) |
46 call remove(v:errors, 0) | 46 call remove(v:errors, 0) |
47 | 47 |
48 call assert_equal('XxxxxxxxxxxxxxxxxxxxxxX', 'XyyyyyyyyyyyyyyyyyyyyyyyyyX') | 48 call assert_equal('XxxxxxxxxxxxxxxxxxxxxxX', 'XyyyyyyyyyyyyyyyyyyyyyyyyyX') |
49 call assert_match("Expected 'X\\\\\\[x occurs 21 times]X' but got 'X\\\\\\[y occurs 25 times]X'", v:errors[0]) | 49 call assert_match("Expected 'X\\\\\\[x occurs 21 times]X' but got 'X\\\\\\[y occurs 25 times]X'", v:errors[0]) |
50 call remove(v:errors, 0) | |
51 endfunc | |
52 | |
53 func Test_assert_equal_dict() | |
54 call assert_equal(0, assert_equal(#{one: 1, two: 2}, #{two: 2, one: 1})) | |
55 | |
56 call assert_equal(1, assert_equal(#{one: 1, two: 2}, #{two: 2, one: 3})) | |
57 call assert_match("Expected {'one': 1} but got {'one': 3} - 1 equal item omitted", v:errors[0]) | |
58 call remove(v:errors, 0) | |
59 | |
60 call assert_equal(1, assert_equal(#{one: 1, two: 2}, #{two: 22, one: 11})) | |
61 call assert_match("Expected {'one': 1, 'two': 2} but got {'one': 11, 'two': 22}", v:errors[0]) | |
62 call remove(v:errors, 0) | |
63 | |
64 call assert_equal(1, assert_equal(#{}, #{two: 2, one: 1})) | |
65 call assert_match("Expected {} but got {'one': 1, 'two': 2}", v:errors[0]) | |
66 call remove(v:errors, 0) | |
67 | |
68 call assert_equal(1, assert_equal(#{two: 2, one: 1}, #{})) | |
69 call assert_match("Expected {'one': 1, 'two': 2} but got {}", v:errors[0]) | |
50 call remove(v:errors, 0) | 70 call remove(v:errors, 0) |
51 endfunc | 71 endfunc |
52 | 72 |
53 func Test_assert_equalfile() | 73 func Test_assert_equalfile() |
54 call assert_equal(1, assert_equalfile('abcabc', 'xyzxyz')) | 74 call assert_equal(1, assert_equalfile('abcabc', 'xyzxyz')) |