diff options
author | watiko <service@mail.watiko.net> | 2015-12-17 17:08:23 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-01-10 09:01:30 +0900 |
commit | 3a6cef9ee6de3ae577114a56343a9e336f900eac (patch) | |
tree | cb46d16350cad5703a9bbad8802bf3200c620f08 /src/nvim/eval.c | |
parent | 2586459118ca589c8393121a5d3696802ed1a606 (diff) | |
download | rneovim-3a6cef9ee6de3ae577114a56343a9e336f900eac.tar.gz rneovim-3a6cef9ee6de3ae577114a56343a9e336f900eac.tar.bz2 rneovim-3a6cef9ee6de3ae577114a56343a9e336f900eac.zip |
vim-patch:7.4.1032
Problem: message from assert_false() does not look nice.
Solution: Handle missing sourcing_name. Use right number of spaces. (Watiko)
Don't use line number if it's zero.
https://github.com/vim/vim/commit/cbfe32953aea09d35d9ac7e5865c915b14e310c1
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 22d3e7c91a..59b8d817cd 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7992,10 +7992,19 @@ static void prepare_assert_error(garray_T *gap) char buf[NUMBUFLEN]; ga_init(gap, 1, 100); - ga_concat(gap, sourcing_name); - vim_snprintf(buf, ARRAY_SIZE(buf), " line %ld", (long)sourcing_lnum); - ga_concat(gap, (char_u *)buf); - ga_concat(gap, (char_u *)": "); + if (sourcing_name != NULL) { + ga_concat(gap, sourcing_name); + if (sourcing_lnum > 0) { + ga_concat(gap, (char_u *)" "); + } + } + if (sourcing_lnum > 0) { + vim_snprintf(buf, ARRAY_SIZE(buf), "line %ld", (long)sourcing_lnum); + ga_concat(gap, (char_u *)buf); + } + if (sourcing_name != NULL || sourcing_lnum > 0) { + ga_concat(gap, (char_u *)": "); + } } // Fill "gap" with information about an assert error. @@ -8062,7 +8071,7 @@ static void assert_bool(typval_T *argvars, bool isTrue) (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue || error) { prepare_assert_error(&ga); fill_assert_error(&ga, &argvars[1], - (char_u *)(isTrue ? "True " : "False "), + (char_u *)(isTrue ? "True" : "False"), NULL, &argvars[0]); assert_error(&ga); ga_clear(&ga); |