]> granicus.if.org Git - vim/commitdiff
patch 8.0.0186: confusing error message from assert_notequal() v8.0.0186
authorBram Moolenaar <Bram@vim.org>
Sat, 14 Jan 2017 19:06:14 +0000 (20:06 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 14 Jan 2017 19:06:14 +0000 (20:06 +0100)
Problem:    The error message from assert_notequal() is confusing.
Solution:   Only mention the expected value.

src/eval.c
src/testdir/test_assert.vim
src/version.c

index 5bed90b3b5560c2e3d3d59b5ad782e2d6ea6dc18..f70d03b369e9aac58a7b41b0d9ce96d678bad793 100644 (file)
@@ -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);
+       }
     }
 }
 
index 25630f2dbcc49ccfd51ead5bdeded97482cb5d57..8c54bddb8a301b24f344cce6f4c24cfd77f80414 100644 (file)
@@ -32,7 +32,7 @@ func Test_assert_notequal()
   call assert_notequal([1, 2, 3], s)
 
   call assert_notequal('foo', s)
-  call assert_match("Expected 'foo' differs from 'foo'", v:errors[0])
+  call assert_match("Expected not equal to 'foo'", v:errors[0])
   call remove(v:errors, 0)
 endfunc
 
index d5fa5495ec980a1dd6c96dd36cb7f9a80573093f..6511b36957311f86d78c47f558afe7b91d4b61db 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    186,
 /**/
     185,
 /**/