2023-04-07 21:09:55 +00:00
|
|
|
use nu_test_support::nu;
|
2022-07-12 11:03:50 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn error_label_works() {
|
2023-04-07 21:09:55 +00:00
|
|
|
let actual = nu!("error make {msg:foo label:{text:unseen}}");
|
2022-07-12 11:03:50 +00:00
|
|
|
|
|
|
|
assert!(actual.err.contains("unseen"));
|
|
|
|
assert!(actual.err.contains("╰──"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn no_span_if_unspanned() {
|
2023-04-07 21:09:55 +00:00
|
|
|
let actual = nu!("error make -u {msg:foo label:{text:unseen}}");
|
2022-07-12 11:03:50 +00:00
|
|
|
|
|
|
|
assert!(!actual.err.contains("unseen"));
|
|
|
|
}
|
2023-03-23 19:31:06 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn error_start_bigger_than_end_should_fail() {
|
2023-04-07 21:09:55 +00:00
|
|
|
let actual = nu!("error make {msg: foo label: {text: bar start 456 end 123}}");
|
2023-03-23 19:31:06 +00:00
|
|
|
|
|
|
|
assert!(!actual.err.contains("invalid error format"));
|
|
|
|
assert!(!actual
|
|
|
|
.err
|
|
|
|
.contains("`$.label.start` should be smaller than `$.label.end`"));
|
|
|
|
}
|