2022-06-19 07:56:31 +03:00
|
|
|
use super::*;
|
2022-05-04 08:04:55 +03:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dont_run_duplicate_recipes() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
2024-09-21 08:25:52 +03:00
|
|
|
@foo:
|
|
|
|
echo foo
|
|
|
|
",
|
2022-05-04 08:04:55 +03:00
|
|
|
)
|
2023-01-04 09:31:56 +03:00
|
|
|
.args(["foo", "foo"])
|
2024-09-21 08:25:52 +03:00
|
|
|
.stdout("foo\n")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn one_flag_only_allows_one_invocation() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
2022-05-04 08:04:55 +03:00
|
|
|
"
|
2024-09-21 08:25:52 +03:00
|
|
|
@foo:
|
|
|
|
echo foo
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.args(["--one", "foo"])
|
|
|
|
.stdout("foo\n")
|
|
|
|
.run();
|
|
|
|
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
@foo:
|
|
|
|
echo foo
|
|
|
|
|
|
|
|
@bar:
|
|
|
|
echo bar
|
|
|
|
",
|
2022-05-04 08:04:55 +03:00
|
|
|
)
|
2024-09-21 08:25:52 +03:00
|
|
|
.args(["--one", "foo", "bar"])
|
|
|
|
.stderr("error: Expected 1 command-line recipe invocation but found 2.\n")
|
|
|
|
.status(1)
|
2022-05-04 08:04:55 +03:00
|
|
|
.run();
|
|
|
|
}
|