forked from extern/nushell
Remove file I/O from tests that don't need it (#11182)
# Description This PR implements modifications to command tests that write unnecessary json and csv to disk then load it with open, by using nuon literals instead. - Fixes #7189 # User-Facing Changes None # Tests + Formatting This only affects existing tests, which still pass.
This commit is contained in:
@ -1,13 +1,8 @@
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn adds_row_data_if_column_missing() {
|
||||
Playground::setup("default_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_amigos.json",
|
||||
r#"
|
||||
let sample = r#"
|
||||
{
|
||||
"amigos": [
|
||||
{"name": "Yehuda"},
|
||||
@ -16,22 +11,19 @@ fn adds_row_data_if_column_missing() {
|
||||
{"name":"GorbyPuff"}
|
||||
]
|
||||
}
|
||||
"#,
|
||||
)]);
|
||||
"#;
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
"
|
||||
open los_tres_amigos.json
|
||||
let actual = nu!(pipeline(&format!(
|
||||
"
|
||||
{sample}
|
||||
| get amigos
|
||||
| default 1 rusty_luck
|
||||
| where rusty_luck == 1
|
||||
| length
|
||||
"
|
||||
));
|
||||
)));
|
||||
|
||||
assert_eq!(actual.out, "2");
|
||||
});
|
||||
assert_eq!(actual.out, "2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user