mirror of
https://github.com/nushell/nushell
synced 2025-01-14 06:04:09 +00:00
Ensure that reduce has a valid span (#4479)
This commit is contained in:
parent
84f85ff9ae
commit
9114a2d31d
2 changed files with 9 additions and 0 deletions
|
@ -196,6 +196,7 @@ impl Command for Reduce {
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.with_span(span)
|
||||||
.into_pipeline_data())
|
.into_pipeline_data())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,3 +235,11 @@ fn export_def_env() -> TestResult {
|
||||||
fn dynamic_let_env() -> TestResult {
|
fn dynamic_let_env() -> TestResult {
|
||||||
run_test(r#"let x = "FOO"; let-env $x = "BAZ"; $env.FOO"#, "BAZ")
|
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 a new issue