add one more test case, adjust err msg
This commit is contained in:
parent
64c579517b
commit
73ac43dbd2
|
@ -205,7 +205,7 @@ fn get_initial_state(
|
||||||
msg: "Missing intial value".to_string(),
|
msg: "Missing intial value".to_string(),
|
||||||
span: Some(span),
|
span: Some(span),
|
||||||
help: Some(
|
help: Some(
|
||||||
"Provide initial value in generate, or assigning default value to closure parameter"
|
"Providing <initial> argument to generate, or assigning default value to closure parameter"
|
||||||
.to_string(),
|
.to_string(),
|
||||||
),
|
),
|
||||||
inner: vec![],
|
inner: vec![],
|
||||||
|
|
|
@ -132,3 +132,19 @@ fn generate_allow_default_parameter() {
|
||||||
));
|
));
|
||||||
assert_eq!(actual.out, "[null, null, done]");
|
assert_eq!(actual.out, "[null, null, done]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn generate_raise_error_on_no_default_parameter_closure_and_init_val() {
|
||||||
|
let actual = nu!(pipeline(
|
||||||
|
r#"
|
||||||
|
generate {|x|
|
||||||
|
if $x == 3 {
|
||||||
|
{out: "done"}
|
||||||
|
} else {
|
||||||
|
{out: null, next: ($x + 1)}
|
||||||
|
}
|
||||||
|
} | to nuon
|
||||||
|
"#
|
||||||
|
));
|
||||||
|
assert_eq!(actual.err, "The initial value is missing");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user