mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 17:03:45 +01: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.
46 lines
999 B
Rust
46 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");
|
|
}
|