2022-06-19 07:56:31 +03:00
|
|
|
use super::*;
|
2020-10-27 04:16:42 +03:00
|
|
|
|
2022-12-20 11:44:19 +03:00
|
|
|
test! {
|
|
|
|
name: invalid_alias_attribute,
|
|
|
|
justfile: "[private]\n[linux]\nalias t := test\n\ntest:\n",
|
|
|
|
stderr: "
|
|
|
|
error: Alias t has an invalid attribute `linux`
|
|
|
|
|
|
|
|
|
3 | alias t := test
|
|
|
|
| ^
|
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
2020-10-27 04:16:42 +03:00
|
|
|
test! {
|
|
|
|
name: expected_keyword,
|
|
|
|
justfile: "foo := if '' == '' { '' } arlo { '' }",
|
|
|
|
stderr: "
|
|
|
|
error: Expected keyword `else` but found identifier `arlo`
|
|
|
|
|
|
|
|
|
1 | foo := if '' == '' { '' } arlo { '' }
|
|
|
|
| ^^^^
|
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
|
|
|
|
|
|
|
test! {
|
|
|
|
name: unexpected_character,
|
2023-01-13 06:25:28 +03:00
|
|
|
justfile: "&~",
|
2020-10-27 04:16:42 +03:00
|
|
|
stderr: "
|
2023-01-13 06:25:28 +03:00
|
|
|
error: Expected character `&`
|
2020-10-27 04:16:42 +03:00
|
|
|
|
|
2023-01-13 06:25:28 +03:00
|
|
|
1 | &~
|
2020-10-27 04:16:42 +03:00
|
|
|
| ^
|
|
|
|
",
|
|
|
|
status: EXIT_FAILURE,
|
|
|
|
}
|
2021-07-29 04:27:47 +03:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn argument_count_mismatch() {
|
|
|
|
Test::new()
|
|
|
|
.justfile("foo a b:")
|
2023-01-04 09:31:56 +03:00
|
|
|
.args(["foo"])
|
2021-07-29 04:27:47 +03:00
|
|
|
.stderr(
|
|
|
|
"
|
|
|
|
error: Recipe `foo` got 0 arguments but takes 2
|
|
|
|
usage:
|
|
|
|
just foo a b
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.status(EXIT_FAILURE)
|
|
|
|
.run();
|
|
|
|
}
|