mirror of
https://github.com/nushell/nushell.git
synced 2024-11-28 19:33:47 +01:00
9870c7c9a6
# Description This PR aims to close #14027, in which it was noticed that the transpose command "swallows" error messages. *Note that in exploring the linked issue, [other situations were identified](https://github.com/nushell/nushell/issues/14027#issuecomment-2414602880) which also produce inconsistent behaviour. These have knowingly been omitted from this PR, to minimize its scope, and since they seem to have a different cause. It's probably best to make a separate issue/PR in which to tackle a broader scan of error handling, with a suspected relation to streams.* # User-Facing Changes The user will see errors from deeper in the pipeline, in case the errors originated there. # Tests + Formatting Toolkit PR check was run successfully. One test was added, covering this exact situation, in order to prevent regressions. The bug is relatively obscure, so it may be prone to reappear during refactorings.
35 lines
812 B
Rust
35 lines
812 B
Rust
use nu_test_support::nu;
|
|
|
|
#[test]
|
|
fn row() {
|
|
let actual = nu!("[[key value]; [foo 1] [foo 2]] | transpose -r | debug");
|
|
|
|
assert!(actual.out.contains("foo: 1"));
|
|
}
|
|
|
|
#[test]
|
|
fn row_but_last() {
|
|
let actual = nu!("[[key value]; [foo 1] [foo 2]] | transpose -r -l | debug");
|
|
|
|
assert!(actual.out.contains("foo: 2"));
|
|
}
|
|
|
|
#[test]
|
|
fn row_but_all() {
|
|
let actual = nu!("[[key value]; [foo 1] [foo 2]] | transpose -r -a | debug");
|
|
|
|
assert!(actual.out.contains("foo: [1, 2]"));
|
|
}
|
|
|
|
#[test]
|
|
fn throw_inner_error() {
|
|
let error_msg = "This message should show up";
|
|
let error = format!("(error make {{ msg: \"{}\" }})", error_msg);
|
|
let actual = nu!(format!(
|
|
"[[key value]; [foo 1] [foo 2] [{} 3]] | transpose",
|
|
error
|
|
));
|
|
|
|
assert!(actual.err.contains(error.as_str()));
|
|
}
|