mirror of
https://github.com/nushell/nushell
synced 2024-12-30 23:08:56 +00:00
54d73748e4
# 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.
45 lines
999 B
Rust
45 lines
999 B
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn wrap_rows_into_a_row() {
|
|
let sample = r#"
|
|
[[first_name, last_name];
|
|
[Andrés, Robalino],
|
|
[JT, Turner],
|
|
[Yehuda, Katz]]
|
|
"#;
|
|
|
|
let actual = nu!(pipeline(&format!(
|
|
"
|
|
{sample}
|
|
| wrap caballeros
|
|
| get caballeros
|
|
| get 0
|
|
| get last_name
|
|
"
|
|
)));
|
|
|
|
assert_eq!(actual.out, "Robalino");
|
|
}
|
|
|
|
#[test]
|
|
fn wrap_rows_into_a_table() {
|
|
let sample = r#"
|
|
[[first_name, last_name];
|
|
[Andrés, Robalino],
|
|
[JT, Turner],
|
|
[Yehuda, Katz]]
|
|
"#;
|
|
|
|
let actual = nu!(pipeline(&format!(
|
|
"
|
|
{sample}
|
|
| get last_name
|
|
| wrap caballero
|
|
| get 2
|
|
| get caballero
|
|
"
|
|
)));
|
|
|
|
assert_eq!(actual.out, "Katz");
|
|
}
|