mirror of
https://github.com/nushell/nushell.git
synced 2025-07-16 06:15:07 +02:00
.cargo
.githooks
.github
assets
benches
crates
nu-cli
nu-cmd-base
nu-cmd-extra
nu-cmd-lang
nu-cmd-plugin
nu-color-config
nu-command
src
tests
commands
assignment
base
bytes
conversions
database
date
debug
hash_
math
move_
network
path
platform
query
random
skip
str_
take
url
alias.rs
all.rs
any.rs
append.rs
break_.rs
cal.rs
cd.rs
chunk_by.rs
chunks.rs
compact.rs
complete.rs
config_env_default.rs
config_nu_default.rs
continue_.rs
debug_info.rs
def.rs
default.rs
detect_columns.rs
do_.rs
drop.rs
du.rs
each.rs
echo.rs
empty.rs
error_make.rs
every.rs
exec.rs
export_def.rs
fill.rs
filter.rs
find.rs
first.rs
flatten.rs
for_.rs
format.rs
generate.rs
get.rs
glob.rs
griddle.rs
group_by.rs
headers.rs
help.rs
histogram.rs
ignore.rs
insert.rs
inspect.rs
interleave.rs
into_datetime.rs
into_filesize.rs
into_int.rs
join.rs
last.rs
length.rs
let_.rs
lines.rs
loop_.rs
ls.rs
match_.rs
merge.rs
mktemp.rs
mod.rs
mut_.rs
nu_check.rs
open.rs
par_each.rs
parse.rs
prepend.rs
print.rs
range.rs
redirection.rs
reduce.rs
reject.rs
rename.rs
return_.rs
reverse.rs
rm.rs
roll.rs
rotate.rs
run_external.rs
save.rs
select.rs
semicolon.rs
seq.rs
seq_char.rs
seq_date.rs
sort.rs
sort_by.rs
source_env.rs
split_by.rs
split_column.rs
split_row.rs
table.rs
tee.rs
terminal.rs
to_text.rs
touch.rs
transpose.rs
try_.rs
ucp.rs
ulimit.rs
umkdir.rs
uname.rs
uniq.rs
uniq_by.rs
update.rs
upsert.rs
use_.rs
utouch.rs
where_.rs
which.rs
while_.rs
window.rs
with_env.rs
wrap.rs
zip.rs
format_conversions
main.rs
sort_utils.rs
Cargo.toml
LICENSE
README.md
nu-derive-value
nu-engine
nu-explore
nu-glob
nu-json
nu-lsp
nu-parser
nu-path
nu-plugin
nu-plugin-core
nu-plugin-engine
nu-plugin-protocol
nu-plugin-test-support
nu-pretty-hex
nu-protocol
nu-std
nu-system
nu-table
nu-term-grid
nu-test-support
nu-utils
nu_plugin_custom_values
nu_plugin_example
nu_plugin_formats
nu_plugin_gstat
nu_plugin_inc
nu_plugin_nu_example
nu_plugin_polars
nu_plugin_python
nu_plugin_query
nu_plugin_stress_internals
nuon
README.md
devdocs
docker
scripts
src
tests
wix
.gitattributes
.gitignore
CITATION.cff
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
Cross.toml
LICENSE
README.md
SECURITY.md
rust-toolchain.toml
toolkit.nu
typos.toml
# 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()));
|
|
}
|