File ChangeLog changed (mode: 100644) (index 3eab8148a..4e2101776) |
71 |
71 |
Added WildBox highlight group. It can be used to set background of |
Added WildBox highlight group. It can be used to set background of |
72 |
72 |
completion window. |
completion window. |
73 |
73 |
|
|
|
74 |
|
Added a statusbar message and a dialog to warn about an upcoming fix for |
|
75 |
|
strings in conditional expressions (e.g., `if $VAR` checks for `$VAR` |
|
76 |
|
being non empty instead of converting it to an integer). Thanks to |
|
77 |
|
justpretending2. |
|
78 |
|
|
74 |
79 |
Don't draw right padding on a truncated rightmost column of a transposed |
Don't draw right padding on a truncated rightmost column of a transposed |
75 |
80 |
ls-like view. |
ls-like view. |
76 |
81 |
|
|
File src/cmd_handlers.c changed (mode: 100644) (index c9bc8b029..02dc65a8e) |
... |
... |
eval_if_condition(int cmd_id, const cmd_info_t *cmd_info) |
3540 |
3540 |
} |
} |
3541 |
3541 |
else |
else |
3542 |
3542 |
{ |
{ |
|
3543 |
|
if(parsing_result.value.type == VTYPE_STRING) |
|
3544 |
|
{ |
|
3545 |
|
static int printed_warning; |
|
3546 |
|
|
|
3547 |
|
ui_sb_errf("warning: checking for string length using a boolean context " |
|
3548 |
|
"is a bug, update `%s` to use `!= ''` to avoid issues in the " |
|
3549 |
|
"future", cmd_info->args); |
|
3550 |
|
int num; |
|
3551 |
|
if(!printed_warning && !read_int(cmd_info->args, &num)) |
|
3552 |
|
{ |
|
3553 |
|
printed_warning = 1; |
|
3554 |
|
|
|
3555 |
|
int save_msg = curr_stats.save_msg; |
|
3556 |
|
curr_stats.save_msg = 1; |
|
3557 |
|
show_error_msgf("Condition evaluation", |
|
3558 |
|
"The `%s` condition seems to be relying on a bug, please revise it " |
|
3559 |
|
"to add `!= ''` to check for an empty string or `+ 0` to suppress " |
|
3560 |
|
"this warning.\n" |
|
3561 |
|
"(This is a once per session warning, `:messages` can contain " |
|
3562 |
|
"more.)\n" |
|
3563 |
|
"(The need for `+ 0` will be gone along with the bug and this " |
|
3564 |
|
"warning in the next release.)", cmd_info->args); |
|
3565 |
|
curr_stats.save_msg = save_msg; |
|
3566 |
|
} |
|
3567 |
|
} |
3543 |
3568 |
result = var_to_bool(parsing_result.value); |
result = var_to_bool(parsing_result.value); |
3544 |
3569 |
} |
} |
3545 |
3570 |
|
|
File tests/parsing/and_or.c changed (mode: 100644) (index ea9cedcbb..832d72523) |
... |
... |
TEST(and_or_ignored_inside_strings) |
85 |
85 |
|
|
86 |
86 |
TEST(strings_are_converted_to_integers) |
TEST(strings_are_converted_to_integers) |
87 |
87 |
{ |
{ |
|
88 |
|
ASSERT_BOOL_OK("''", 0); |
|
89 |
|
/* The following checks must be inverted when the bug is fixed (breaks |
|
90 |
|
* compatibility). */ |
|
91 |
|
ASSERT_BOOL_OK("'a'", 1); |
|
92 |
|
ASSERT_BOOL_OK("'0'", 1); |
|
93 |
|
ASSERT_BOOL_OK("'0'", 1); |
|
94 |
|
|
88 |
95 |
ASSERT_OK("'a' && 'b' && 'c'", "0"); |
ASSERT_OK("'a' && 'b' && 'c'", "0"); |
89 |
96 |
ASSERT_OK("'0' && '0' && '0'", "0"); |
ASSERT_OK("'0' && '0' && '0'", "0"); |
90 |
97 |
ASSERT_OK("'1' && '2' && '4'", "1"); |
ASSERT_OK("'1' && '2' && '4'", "1"); |
File tests/parsing/asserts.h changed (mode: 100644) (index 60d4dec94..785a8941a) |
38 |
38 |
} \ |
} \ |
39 |
39 |
while(0) |
while(0) |
40 |
40 |
|
|
|
41 |
|
/* This should be a macro to see what test has failed. */ |
|
42 |
|
#define ASSERT_BOOL_OK(str, expected) \ |
|
43 |
|
do \ |
|
44 |
|
{ \ |
|
45 |
|
parsing_result_t result = vle_parser_eval((str), /*interactive=*/0); \ |
|
46 |
|
assert_int_equal(PE_NO_ERROR, result.error); \ |
|
47 |
|
\ |
|
48 |
|
if(result.value.type != VTYPE_ERROR) \ |
|
49 |
|
{ \ |
|
50 |
|
int bool_res = var_to_bool(result.value); \ |
|
51 |
|
if(expected) \ |
|
52 |
|
{ \ |
|
53 |
|
assert_true(bool_res); \ |
|
54 |
|
} \ |
|
55 |
|
else \ |
|
56 |
|
{ \ |
|
57 |
|
assert_false(bool_res); \ |
|
58 |
|
} \ |
|
59 |
|
} \ |
|
60 |
|
\ |
|
61 |
|
var_free(result.value); \ |
|
62 |
|
} \ |
|
63 |
|
while(0) |
|
64 |
|
|
41 |
65 |
/* This should be a macro to see what test has failed. */ |
/* This should be a macro to see what test has failed. */ |
42 |
66 |
#define ASSERT_FAIL(str, error_code) \ |
#define ASSERT_FAIL(str, error_code) \ |
43 |
67 |
do \ |
do \ |