mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
Prevents duplicate fields in transpose -r
(#5840)
This commit is contained in:
@ -65,6 +65,7 @@ mod split_row;
|
||||
mod str_;
|
||||
mod take;
|
||||
mod touch;
|
||||
mod transpose;
|
||||
mod uniq;
|
||||
mod update;
|
||||
mod upsert;
|
||||
|
37
crates/nu-command/tests/commands/transpose.rs
Normal file
37
crates/nu-command/tests/commands/transpose.rs
Normal file
@ -0,0 +1,37 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn row() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[key value]; [foo 1] [foo 2]] | transpose -r | debug
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("foo: 1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn row_but_last() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[key value]; [foo 1] [foo 2]] | transpose -r -l | debug
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("foo: 2"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn row_but_all() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[key value]; [foo 1] [foo 2]] | transpose -r -a | debug
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("foo: [1, 2]"));
|
||||
}
|
Reference in New Issue
Block a user