2023-07-25 02:05:47 -07:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn newline_escape_deps() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
default: a \\
|
|
|
|
b \\
|
|
|
|
c
|
|
|
|
a:
|
|
|
|
echo a
|
|
|
|
b:
|
|
|
|
echo b
|
|
|
|
c:
|
|
|
|
echo c
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stdout("a\nb\nc\n")
|
|
|
|
.stderr("echo a\necho b\necho c\n")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn newline_escape_deps_no_indent() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
default: a\\
|
|
|
|
b\\
|
|
|
|
c
|
|
|
|
a:
|
|
|
|
echo a
|
|
|
|
b:
|
|
|
|
echo b
|
|
|
|
c:
|
|
|
|
echo c
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stdout("a\nb\nc\n")
|
|
|
|
.stderr("echo a\necho b\necho c\n")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn newline_escape_deps_linefeed() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
2023-07-25 02:14:13 -07:00
|
|
|
default: a\\\r
|
|
|
|
b
|
|
|
|
a:
|
|
|
|
echo a
|
|
|
|
b:
|
|
|
|
echo b
|
|
|
|
",
|
2023-07-25 02:05:47 -07:00
|
|
|
)
|
|
|
|
.stdout("a\nb\n")
|
|
|
|
.stderr("echo a\necho b\n")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn newline_escape_deps_invalid_esc() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
default: a\\ b
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stdout("")
|
|
|
|
.stderr(
|
2023-07-25 02:14:13 -07:00
|
|
|
"
|
|
|
|
error: `\\ ` is not a valid escape sequence
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:11
|
|
|
|
│
|
|
|
|
1 │ default: a\\ b
|
|
|
|
│ ^
|
2023-07-25 02:14:13 -07:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn newline_escape_unpaired_linefeed() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
default:\\\ra",
|
|
|
|
)
|
|
|
|
.stdout("")
|
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Unpaired carriage return
|
2023-12-29 13:25:30 -08:00
|
|
|
——▶ justfile:1:9
|
|
|
|
│
|
|
|
|
1 │ default:\\\ra
|
|
|
|
│ ^
|
2023-07-25 02:14:13 -07:00
|
|
|
",
|
2023-07-25 02:05:47 -07:00
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|