From 7d9a77f179939b937205c19f6050a8fef636eb95 Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Wed, 18 May 2022 19:20:26 +0800 Subject: [PATCH] fix select tests (#5577) --- crates/nu-command/src/filters/select.rs | 8 ++++---- crates/nu-command/tests/commands/select.rs | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/nu-command/src/filters/select.rs b/crates/nu-command/src/filters/select.rs index a6d2aa3929..f19d437686 100644 --- a/crates/nu-command/src/filters/select.rs +++ b/crates/nu-command/src/filters/select.rs @@ -126,7 +126,7 @@ fn select( //FIXME: improve implementation to not clone let fetcher = input_val.clone().follow_cell_path(&path.members)?; - cols.push(path.into_string()); + cols.push(path.into_string().replace('.', "_")); vals.push(fetcher); } @@ -150,11 +150,11 @@ fn select( //FIXME: improve implementation to not clone match x.clone().follow_cell_path(&path.members) { Ok(value) => { - cols.push(path.into_string()); + cols.push(path.into_string().replace('.', "_")); vals.push(value); } Err(_) => { - cols.push(path.into_string()); + cols.push(path.into_string().replace('.', "_")); vals.push(Value::Nothing { span }); } } @@ -175,7 +175,7 @@ fn select( // FIXME: remove clone let result = v.clone().follow_cell_path(&cell_path.members)?; - cols.push(cell_path.into_string()); + cols.push(cell_path.into_string().replace('.', "_")); vals.push(result); } diff --git a/crates/nu-command/tests/commands/select.rs b/crates/nu-command/tests/commands/select.rs index 13e3ccc177..d8c59aa02a 100644 --- a/crates/nu-command/tests/commands/select.rs +++ b/crates/nu-command/tests/commands/select.rs @@ -22,8 +22,6 @@ fn regular_columns() { assert_eq!(actual.out, "Robalino"); } -// FIXME: jt: needs more work -#[ignore] #[test] fn complex_nested_columns() { Playground::setup("select_test_2", |dirs, sandbox| { @@ -57,8 +55,9 @@ fn complex_nested_columns() { r#" open los_tres_caballeros.json | select nu."0xATYKARNU" nu.committers.name nu.releases.version - | where nu_releases_version > "0.8" | get nu_releases_version + | where $it > "0.8" + | get 0 "# ));