mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
713a957e9c
commit
ceade2fe53
@ -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.
|
||||
|
@ -766,7 +766,7 @@ static const int included_patches[] = {
|
||||
// 189,
|
||||
188,
|
||||
// 187 NA
|
||||
// 186,
|
||||
186,
|
||||
// 185,
|
||||
// 184,
|
||||
// 183,
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user