1
1
mirror of https://github.com/casey/just.git synced 2024-11-22 18:34:06 +03:00
just/tests/quiet.rs
2024-07-27 22:00:19 +00:00

240 lines
3.2 KiB
Rust

use super::*;
test! {
name: no_stdout,
justfile: r"
default:
@echo hello
",
args: ("--quiet"),
stdout: "",
}
test! {
name: stderr,
justfile: r"
default:
@echo hello 1>&2
",
args: ("--quiet"),
stdout: "",
}
test! {
name: command_echoing,
justfile: r"
default:
exit
",
args: ("--quiet"),
stdout: "",
}
test! {
name: error_messages,
justfile: r"
default:
exit 100
",
args: ("--quiet"),
stdout: "",
status: 100,
}
test! {
name: assignment_backtick_stderr,
justfile: r"
a := `echo hello 1>&2`
default:
exit 100
",
args: ("--quiet"),
stdout: "",
status: 100,
}
test! {
name: interpolation_backtick_stderr,
justfile: r"
default:
echo `echo hello 1>&2`
exit 100
",
args: ("--quiet"),
stdout: "",
status: 100,
}
test! {
name: choose_none,
justfile: "",
args: ("--choose", "--quiet"),
status: EXIT_FAILURE,
}
test! {
name: choose_invocation,
justfile: "foo:",
args: ("--choose", "--quiet", "--shell", "asdfasdfasfdasdfasdfadsf"),
status: EXIT_FAILURE,
shell: false,
}
test! {
name: choose_status,
justfile: "foo:",
args: ("--choose", "--quiet", "--chooser", "/usr/bin/env false"),
status: EXIT_FAILURE,
}
test! {
name: edit_invocation,
justfile: "foo:",
args: ("--edit", "--quiet"),
env: {
"VISUAL": "adsfasdfasdfadsfadfsaf",
},
status: EXIT_FAILURE,
}
test! {
name: edit_status,
justfile: "foo:",
args: ("--edit", "--quiet"),
env: {
"VISUAL": "false",
},
status: EXIT_FAILURE,
}
test! {
name: init_exists,
justfile: "foo:",
args: ("--init", "--quiet"),
status: EXIT_FAILURE,
}
test! {
name: show_missing,
justfile: "foo:",
args: ("--show", "bar", "--quiet"),
status: EXIT_FAILURE,
}
test! {
name: quiet_shebang,
justfile: "
@foo:
#!/bin/sh
",
args: ("--quiet"),
}
#[test]
fn no_quiet_setting() {
Test::new()
.justfile(
"
foo:
echo FOO
",
)
.stdout("FOO\n")
.stderr("echo FOO\n")
.run();
}
#[test]
fn quiet_setting() {
Test::new()
.justfile(
"
set quiet
foo:
echo FOO
",
)
.stdout("FOO\n")
.run();
}
#[test]
fn quiet_setting_with_no_quiet_attribute() {
Test::new()
.justfile(
"
set quiet
[no-quiet]
foo:
echo FOO
",
)
.stdout("FOO\n")
.stderr("echo FOO\n")
.run();
}
#[test]
fn quiet_setting_with_quiet_recipe() {
Test::new()
.justfile(
"
set quiet
@foo:
echo FOO
",
)
.stdout("FOO\n")
.run();
}
#[test]
fn quiet_setting_with_quiet_line() {
Test::new()
.justfile(
"
set quiet
foo:
@echo FOO
",
)
.stdout("FOO\n")
.run();
}
#[test]
fn quiet_setting_with_no_quiet_attribute_and_quiet_recipe() {
Test::new()
.justfile(
"
set quiet
[no-quiet]
@foo:
echo FOO
",
)
.stdout("FOO\n")
.run();
}
#[test]
fn quiet_setting_with_no_quiet_attribute_and_quiet_line() {
Test::new()
.justfile(
"
set quiet
[no-quiet]
foo:
@echo FOO
",
)
.stdout("FOO\n")
.run();
}