2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2021-11-04 21:35:57 -07:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn ignore_leading_byte_order_mark() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
\u{feff}foo:
|
|
|
|
echo bar
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stderr("echo bar\n")
|
|
|
|
.stdout("bar\n")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn non_leading_byte_order_mark_produces_error() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
foo:
|
|
|
|
echo bar
|
|
|
|
\u{feff}
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.stderr(
|
|
|
|
"
|
2023-12-19 20:31:51 -08:00
|
|
|
error: Expected \'@\', \'[\', comment, end of file, end of line, or identifier, but found byte order mark
|
2023-11-21 20:17:38 -08:00
|
|
|
--> justfile:3:1
|
2021-11-04 21:35:57 -07:00
|
|
|
|
|
|
|
|
3 | \u{feff}
|
|
|
|
| ^
|
|
|
|
")
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dont_mention_byte_order_mark_in_errors() {
|
|
|
|
Test::new()
|
|
|
|
.justfile("{")
|
|
|
|
.stderr(
|
|
|
|
"
|
2023-12-19 20:31:51 -08:00
|
|
|
error: Expected '@', '[', comment, end of file, end of line, or identifier, but found '{'
|
2023-11-21 20:17:38 -08:00
|
|
|
--> justfile:1:1
|
2021-11-04 21:35:57 -07:00
|
|
|
|
|
|
|
|
1 | {
|
|
|
|
| ^
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|