1
1
mirror of https://github.com/casey/just.git synced 2024-11-23 11:04:09 +03:00
just/tests/newline_escape.rs
2023-07-25 09:14:13 +00:00

103 lines
1.5 KiB
Rust

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
|
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();
}