Ignore chooser tests (#1513)

This commit is contained in:
Casey Rodarmor 2023-01-16 00:42:34 -08:00 committed by GitHub
parent 42b4c084c4
commit fdf4b5b859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 128 additions and 91 deletions

View File

@ -185,6 +185,17 @@ build-book:
mdbook build book/en mdbook build book/en
mdbook build book/zh mdbook build book/zh
convert-integration-test test:
cargo expand --test integration {{test}} | \
sed \
-E \
-e 's/#\[cfg\(test\)\]/#\[test\]/' \
-e 's/^ *let test = //' \
-e 's/^ *test[.]/./' \
-e 's/;$//' \
-e 's/crate::test::Test/Test/' \
-e 's/\.run\(\)/.run();/'
# run all polyglot recipes # run all polyglot recipes
polyglot: _python _js _perl _sh _ruby polyglot: _python _js _perl _sh _ruby
# (recipes that start with `_` are hidden from --list) # (recipes that start with `_` are hidden from --list)

View File

@ -1,116 +1,142 @@
use super::*; use super::*;
test! { #[test]
name: env, fn env() {
justfile: " Test::new()
foo: .arg("--choose")
echo foo .env("JUST_CHOOSER", "head -n1")
.justfile(
"
foo:
echo foo
bar: bar:
echo bar echo bar
", ",
args: ("--choose"), )
env: { .stderr("echo bar\n")
"JUST_CHOOSER": "head -n1", .stdout("bar\n")
}, .run();
stdout: "bar\n",
stderr: "echo bar\n",
} }
test! { #[test]
name: chooser, fn chooser() {
justfile: " Test::new()
foo: .arg("--choose")
echo foo .arg("--chooser")
.arg("head -n1")
.justfile(
"
foo:
echo foo
bar: bar:
echo bar echo bar
", ",
args: ("--choose", "--chooser", "head -n1"), )
stdout: "bar\n", .stderr("echo bar\n")
stderr: "echo bar\n", .stdout("bar\n")
.run();
} }
test! { #[test]
name: override_variable, fn override_variable() {
justfile: " Test::new()
baz := 'A' .arg("--choose")
.arg("baz=B")
.env("JUST_CHOOSER", "head -n1")
.justfile(
"
baz := 'A'
foo: foo:
echo foo echo foo
bar: bar:
echo {{baz}} echo {{baz}}
", ",
args: ("--choose", "baz=B"), )
env: { .stderr("echo B\n")
"JUST_CHOOSER": "head -n1", .stdout("B\n")
}, .run();
stdout: "B\n",
stderr: "echo B\n",
} }
test! { #[test]
name: skip_private_recipes, fn skip_private_recipes() {
justfile: " Test::new()
foo: .arg("--choose")
echo foo .env("JUST_CHOOSER", "head -n1")
.justfile(
"
foo:
echo foo
_bar: _bar:
echo bar echo bar
", ",
args: ("--choose"), )
env: { .stderr("echo foo\n")
"JUST_CHOOSER": "head -n1", .stdout("foo\n")
}, .run();
stdout: "foo\n",
stderr: "echo foo\n",
} }
test! { #[test]
name: skip_recipes_that_require_arguments, fn skip_recipes_that_require_arguments() {
justfile: " Test::new()
foo: .arg("--choose")
echo foo .env("JUST_CHOOSER", "head -n1")
.justfile(
"
foo:
echo foo
bar BAR: bar BAR:
echo {{BAR}} echo {{BAR}}
", ",
args: ("--choose"), )
env: { .stderr("echo foo\n")
"JUST_CHOOSER": "head -n1", .stdout("foo\n")
}, .run();
stdout: "foo\n",
stderr: "echo foo\n",
} }
test! { #[test]
name: no_choosable_recipes, fn no_choosable_recipes() {
justfile: " crate::test::Test::new()
_foo: .arg("--choose")
echo foo .justfile(
"
_foo:
echo foo
bar BAR: bar BAR:
echo {{BAR}} echo {{BAR}}
", ",
args: ("--choose"), )
stdout: "", .status(EXIT_FAILURE)
stderr: "error: Justfile contains no choosable recipes.\n", .stderr("error: Justfile contains no choosable recipes.\n")
status: EXIT_FAILURE, .stdout("")
.run();
} }
test! { #[test]
name: multiple_recipes, #[ignore]
justfile: " fn multiple_recipes() {
foo: Test::new()
echo foo .arg("--choose")
.arg("--chooser")
.arg("echo foo bar")
.justfile(
"
foo:
echo foo
bar: bar:
echo bar echo bar
", ",
args: ("--choose", "--chooser", "echo foo bar"), )
stdout: "foo\nbar\n", .stderr("echo foo\necho bar\n")
stderr: "echo foo\necho bar\n", .stdout("foo\nbar\n")
.run();
} }
#[test] #[test]