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:
Renan Ribeiro
2023-11-29 19:21:34 -03:00
committed by GitHub
parent d08e254d16
commit 54d73748e4
20 changed files with 414 additions and 760 deletions

View File

@ -1,4 +1,4 @@
use nu_test_support::fs::Stub::{EmptyFile, FileWithContentToBeTrimmed};
use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
@ -24,10 +24,7 @@ fn regular_columns() {
#[test]
fn complex_nested_columns() {
Playground::setup("select_test_2", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"los_tres_caballeros.json",
r#"
let sample = r#"
{
"nu": {
"committers": [
@ -47,22 +44,19 @@ fn complex_nested_columns() {
]
}
}
"#,
)]);
"#;
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
open los_tres_caballeros.json
let actual = nu!(pipeline(&format!(
r#"
{sample}
| select nu."0xATYKARNU" nu.committers.name nu.releases.version
| get nu_releases_version
| where $it > "0.8"
| get 0
"#
));
)));
assert_eq!(actual.out, "0.9999999");
})
assert_eq!(actual.out, "0.9999999");
}
#[test]