From 53d5f004df7dfa957149fcd32d553af8352fd8d0 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 25 Jul 2023 02:14:13 -0700 Subject: [PATCH] Test unpaired escaped carriage return error (#1650) --- tests/newline_escape.rs | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/tests/newline_escape.rs b/tests/newline_escape.rs index 2b278fbb..e83f4c62 100644 --- a/tests/newline_escape.rs +++ b/tests/newline_escape.rs @@ -47,13 +47,13 @@ fn newline_escape_deps_linefeed() { Test::new() .justfile( " - default: a\\\r - b - a: - echo a - b: - echo b - ", + default: a\\\r + b + a: + echo a + b: + echo b + ", ) .stdout("a\nb\n") .stderr("echo a\necho b\n") @@ -70,7 +70,32 @@ fn newline_escape_deps_invalid_esc() { ) .stdout("") .stderr( - "error: `\\ ` is not a valid escape sequence\n |\n1 | default: a\\ b\n | ^\n", + " + error: `\\ ` is not a valid escape sequence + | + 1 | default: a\\ b + | ^ + ", + ) + .status(EXIT_FAILURE) + .run(); +} + +#[test] +fn newline_escape_unpaired_linefeed() { + Test::new() + .justfile( + " + default:\\\ra", + ) + .stdout("") + .stderr( + " + error: Unpaired carriage return + | + 1 | default:\\\ra + | ^ + ", ) .status(EXIT_FAILURE) .run();