mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.0186: confusing error message from assert_notequal()
Problem: The error message from assert_notequal() is confusing. Solution: Only mention the expected value.
This commit is contained in:
23
src/eval.c
23
src/eval.c
@@ -9256,6 +9256,8 @@ fill_assert_error(
|
|||||||
{
|
{
|
||||||
if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH)
|
if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH)
|
||||||
ga_concat(gap, (char_u *)"Pattern ");
|
ga_concat(gap, (char_u *)"Pattern ");
|
||||||
|
else if (atype == ASSERT_NOTEQUAL)
|
||||||
|
ga_concat(gap, (char_u *)"Expected not equal to ");
|
||||||
else
|
else
|
||||||
ga_concat(gap, (char_u *)"Expected ");
|
ga_concat(gap, (char_u *)"Expected ");
|
||||||
if (exp_str == NULL)
|
if (exp_str == NULL)
|
||||||
@@ -9265,16 +9267,17 @@ fill_assert_error(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ga_concat_esc(gap, exp_str);
|
ga_concat_esc(gap, exp_str);
|
||||||
if (atype == ASSERT_MATCH)
|
if (atype != ASSERT_NOTEQUAL)
|
||||||
ga_concat(gap, (char_u *)" does not match ");
|
{
|
||||||
else if (atype == ASSERT_NOTMATCH)
|
if (atype == ASSERT_MATCH)
|
||||||
ga_concat(gap, (char_u *)" does match ");
|
ga_concat(gap, (char_u *)" does not match ");
|
||||||
else if (atype == ASSERT_NOTEQUAL)
|
else if (atype == ASSERT_NOTMATCH)
|
||||||
ga_concat(gap, (char_u *)" differs from ");
|
ga_concat(gap, (char_u *)" does match ");
|
||||||
else
|
else
|
||||||
ga_concat(gap, (char_u *)" but got ");
|
ga_concat(gap, (char_u *)" but got ");
|
||||||
ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0));
|
ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0));
|
||||||
vim_free(tofree);
|
vim_free(tofree);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ func Test_assert_notequal()
|
|||||||
call assert_notequal([1, 2, 3], s)
|
call assert_notequal([1, 2, 3], s)
|
||||||
|
|
||||||
call assert_notequal('foo', 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)
|
call remove(v:errors, 0)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
186,
|
||||||
/**/
|
/**/
|
||||||
185,
|
185,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user