mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 23:49:44 +01:00
Ensure that reduce has a valid span (#4479)
This commit is contained in:
parent
84f85ff9ae
commit
9114a2d31d
@ -196,6 +196,7 @@ impl Command for Reduce {
|
||||
v
|
||||
}
|
||||
})
|
||||
.with_span(span)
|
||||
.into_pipeline_data())
|
||||
}
|
||||
}
|
||||
|
@ -235,3 +235,11 @@ fn export_def_env() -> TestResult {
|
||||
fn dynamic_let_env() -> TestResult {
|
||||
run_test(r#"let x = "FOO"; let-env $x = "BAZ"; $env.FOO"#, "BAZ")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reduce_spans() -> TestResult {
|
||||
fail_test(
|
||||
r#"let x = ([1, 2, 3] | reduce -f 0 { $it.item + 2 * $it.acc }); error make {msg: "oh that hurts", label: {text: "right here", start: (metadata $x).span.start, end: (metadata $x).span.end } }"#,
|
||||
"right here",
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user