diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-01-14 20:06:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-01-14 20:06:14 +0100 |
commit | 5869cf060e60cc09e71b2b3bd85f0576ec78f9f5 (patch) | |
tree | 12b84676d1718a5ab703c711a5a2f50d33b59956 /src/eval.c | |
parent | fad609d067926d350b4e4ee6ecb55bdbf111a272 (diff) | |
download | vim-git-5869cf060e60cc09e71b2b3bd85f0576ec78f9f5.tar.gz |
patch 8.0.0186: confusing error message from assert_notequal()v8.0.0186
Problem: The error message from assert_notequal() is confusing.
Solution: Only mention the expected value.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/eval.c b/src/eval.c index 5bed90b3b..f70d03b36 100644 --- a/src/eval.c +++ b/src/eval.c @@ -9256,6 +9256,8 @@ fill_assert_error( { if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH) ga_concat(gap, (char_u *)"Pattern "); + else if (atype == ASSERT_NOTEQUAL) + ga_concat(gap, (char_u *)"Expected not equal to "); else ga_concat(gap, (char_u *)"Expected "); if (exp_str == NULL) @@ -9265,16 +9267,17 @@ fill_assert_error( } else ga_concat_esc(gap, exp_str); - if (atype == ASSERT_MATCH) - ga_concat(gap, (char_u *)" does not match "); - else if (atype == ASSERT_NOTMATCH) - ga_concat(gap, (char_u *)" does match "); - else if (atype == ASSERT_NOTEQUAL) - ga_concat(gap, (char_u *)" differs from "); - else - ga_concat(gap, (char_u *)" but got "); - ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0)); - vim_free(tofree); + if (atype != ASSERT_NOTEQUAL) + { + if (atype == ASSERT_MATCH) + ga_concat(gap, (char_u *)" does not match "); + else if (atype == ASSERT_NOTMATCH) + ga_concat(gap, (char_u *)" does match "); + else + ga_concat(gap, (char_u *)" but got "); + ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0)); + vim_free(tofree); + } } } |