Clean up tests containing unnecessary cwd: tokens (#9692)

# Description
The working directory doesn't have to be set for those tests (or would
be the default anyways). When appropriate also remove calls to the
`pipeline()` function. In most places kept the diff minimal and only
removed the superfluous part to not pollute the blame view. With simpler
tests also simplified things to make them more readable overall (this
included removal of the raw string literal).

Work for #8670
This commit is contained in:
Stefan Holderbach
2023-07-17 18:43:51 +02:00
committed by GitHub
parent 48271d8c3e
commit 656f707a0b
70 changed files with 611 additions and 1344 deletions

View File

@ -4,12 +4,7 @@ use nu_test_support::{nu, nu_repl_code, pipeline};
#[test]
fn help_commands_length() {
let actual = nu!(
cwd: ".", pipeline(
r#"
help commands | length
"#
));
let actual = nu!("help commands | length");
let output = actual.out;
let output_int: i32 = output.parse().unwrap();
@ -68,7 +63,7 @@ fn help_alias_usage_2() {
"alias SPAM = print 'spam' # line2",
"help aliases | where name == SPAM | get 0.usage",
];
let actual = nu!(cwd: ".", nu_repl_code(code));
let actual = nu!(nu_repl_code(code));
assert_eq!(actual.out, "line2");
}
@ -368,7 +363,7 @@ fn help_modules_main_2() {
"help modules | where name == spam | get 0.commands.0",
];
let actual = nu!(cwd: ".", pipeline(&inp.join("; ")));
let actual = nu!(pipeline(&inp.join("; ")));
assert_eq!(actual.out, "spam");
}
@ -381,7 +376,7 @@ fn help_alias_before_command() {
"def SPAM [] { 'spam' }",
"help SPAM",
];
let actual = nu!(cwd: ".", nu_repl_code(code));
let actual = nu!(nu_repl_code(code));
assert!(actual.out.contains("Alias"));
}