chore(release): prepare public source release
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
|
||||
fn cargo_command() -> Command {
|
||||
Command::cargo_bin("msudo").expect("binary")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_user_requires_dangerous_flag() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.args(["--user", "system", "--", "cmd", "/d", "/c", "whoami"])
|
||||
.assert()
|
||||
.code(2)
|
||||
.stderr(predicate::str::contains("--dangerous"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_subcommand_without_payload_is_usage_error() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.arg("run")
|
||||
.assert()
|
||||
.code(2)
|
||||
.stderr(predicate::str::contains(
|
||||
"provide a command after -- or select --shell <preset>",
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_process_user_rejects_token_shaping_before_launch() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.args([
|
||||
"--user",
|
||||
"current-process",
|
||||
"--privileges",
|
||||
"enable-all",
|
||||
"--",
|
||||
"cmd",
|
||||
])
|
||||
.assert()
|
||||
.code(2)
|
||||
.stderr(predicate::str::contains(
|
||||
"--user current-process cannot be combined with token shaping options",
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_user_identity_is_accepted_by_the_installed_cli_parser() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.args([
|
||||
"--user",
|
||||
"current-user",
|
||||
"--same-console",
|
||||
"--new-window",
|
||||
"--",
|
||||
"cmd",
|
||||
])
|
||||
.assert()
|
||||
.code(2)
|
||||
.stderr(predicate::str::contains(
|
||||
"--same-console cannot be combined with --new-window",
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn short_nsudo_style_user_values_are_not_native_cli() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.args(["--user", "p", "--privileges", "enable-all", "--", "cmd"])
|
||||
.assert()
|
||||
.code(2)
|
||||
.stderr(predicate::str::contains("invalid --user value 'p'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_help_mentions_same_console_and_new_window_defaults() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.args(["run", "--help"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("--format <FORMAT>"))
|
||||
.stdout(predicate::str::contains("--json"))
|
||||
.stdout(predicate::str::contains("--toon"))
|
||||
.stdout(predicate::str::contains("--same-console"))
|
||||
.stdout(predicate::str::contains("--new-window"))
|
||||
.stdout(predicate::str::contains(
|
||||
"Interactive shells open in a new window by default",
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user