just/tests/newline_escape.rs

78 lines
1.1 KiB
Rust
Raw Normal View History

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(
"
default: a\\\r
b
a:
echo a
b:
echo b
",
)
.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(
"error: `\\ ` is not a valid escape sequence\n |\n1 | default: a\\ b\n | ^\n",
)
.status(EXIT_FAILURE)
.run();
}