correct echo behavior

This commit is contained in:
arthur
2020-05-22 10:49:35 +02:00
parent e569815146
commit df8ded7b93
3 changed files with 34 additions and 10 deletions
+4 -4
View File
@@ -22,15 +22,15 @@ Test(echo, with_simple_backslash, .init = cr_redirect_stdout)
env_t env = {};
char *av[] = {"echo", "\\n", NULL};
builtin_echo(av, &env);
cr_assert_stdout_eq_str("n\n");
cr_assert_stdout_eq_str("\n\n");
}
Test(echo, with_double_backslash, .init = cr_redirect_stdout)
Test(echo, incorrect_ascii, .init = cr_redirect_stdout)
{
env_t env = {};
char *av[] = {"echo", "\\\\n", NULL};
char *av[] = {"echo", "\\q", NULL};
builtin_echo(av, &env);
cr_assert_stdout_eq_str("\\n\n");
cr_assert_stdout_eq_str("\\q\n");
}
Test(echo, multiple_args, .init = cr_redirect_stdout)