vim-patch:8.0.0186 (#7154)

Problem:    The error message from assert_notequal() is confusing.
Solution:   Only mention the expected value.

5869cf060e
This commit is contained in:
KunMing Xie 2017-09-10 18:52:43 +08:00 committed by Justin M. Keyes
parent 713a957e9c
commit ceade2fe53
3 changed files with 15 additions and 13 deletions

View File

@ -6747,6 +6747,8 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv,
} else {
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 ");
}
@ -6757,19 +6759,19 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv,
} else {
ga_concat(gap, exp_str);
}
tofree = (char_u *)encode_tv2string(got_tv, NULL);
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 if (atype == ASSERT_NOTEQUAL) {
ga_concat(gap, (char_u *)" differs from ");
} else {
ga_concat(gap, (char_u *)" but got ");
}
tofree = (char_u *)encode_tv2string(got_tv, NULL);
ga_concat(gap, tofree);
xfree(tofree);
}
}
}
// Add an assert error to v:errors.

View File

@ -766,7 +766,7 @@ static const int included_patches[] = {
// 189,
188,
// 187 NA
// 186,
186,
// 185,
// 184,
// 183,

View File

@ -89,7 +89,7 @@ describe('assert function:', function()
it('should change v:errors when expected is equal to actual', function()
call('assert_notequal', 'foo', 'foo')
expected_errors({"Expected 'foo' differs from 'foo'"})
expected_errors({"Expected not equal to 'foo'"})
end)
end)