Echi bad color (#15986)
* Outputting error on ecHi bad color * Added a testcase
This commit is contained in:
parent
78e21373be
commit
7a39bb9245
|
@ -465,6 +465,11 @@ static int cmd_eval(void *data, const char *input) {
|
|||
char *dup = r_str_newf ("bgonly %s", argv[0]);
|
||||
color_code = r_cons_pal_parse (dup, NULL);
|
||||
R_FREE (dup);
|
||||
if (!color_code) {
|
||||
eprintf ("Unknown color %s\n", argv[0]);
|
||||
r_str_argv_free (argv);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'w': // "ecHw"
|
||||
|
@ -477,14 +482,13 @@ static int cmd_eval(void *data, const char *input) {
|
|||
if (argc > 1) {
|
||||
char *dup = r_str_newf ("bgonly %s", argv[1]);
|
||||
color_code = r_cons_pal_parse (dup, NULL);
|
||||
R_FREE (dup);
|
||||
if (!color_code) {
|
||||
eprintf ("Unknown color %s\n", argv[1]);
|
||||
r_str_argv_free (argv);
|
||||
free (dup);
|
||||
free (word);
|
||||
return true;
|
||||
}
|
||||
R_FREE (dup);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -278,3 +278,13 @@ ec comment rgb:001296 . italic
|
|||
ec fname rgb:8d0004 . bold italic
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=ecHi
|
||||
FILE=-
|
||||
CMDS=<<EOF
|
||||
ecHi xxxx
|
||||
EOF
|
||||
EXPECT_ERR=<<EOF
|
||||
Unknown color xxxx
|
||||
EOF
|
||||
RUN
|
||||
|
|
Loading…
Reference in New Issue