add unspanned flag to error make, add tests (#6017)

* add `unspanned` flag to error make, add tests

* fmt
This commit is contained in:
pwygab
2022-07-12 19:03:50 +08:00
committed by GitHub
parent a5470b2362
commit a54f9719e5
3 changed files with 57 additions and 12 deletions

View File

@ -0,0 +1,26 @@
use nu_test_support::{nu, pipeline};
#[test]
fn error_label_works() {
let actual = nu!(
cwd: ".", pipeline(
r#"
error make {msg:foo label:{text:unseen}}
"#
));
assert!(actual.err.contains("unseen"));
assert!(actual.err.contains("╰──"));
}
#[test]
fn no_span_if_unspanned() {
let actual = nu!(
cwd: ".", pipeline(
r#"
error make -u {msg:foo label:{text:unseen}}
"#
));
assert!(!actual.err.contains("unseen"));
}

View File

@ -15,6 +15,7 @@ mod each;
mod echo;
mod empty;
mod enter;
mod error_make;
mod every;
mod find;
mod first;