add more tests for new behavior
This commit is contained in:
parent
e81d2860ef
commit
0bf2e7a9e8
|
@ -45,6 +45,13 @@ fn mut_takes_pipeline() {
|
|||
assert_eq!(actual.out, "11");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mut_takes_pipeline_with_declared_type() {
|
||||
let actual = nu!(r#"mut x: list<string> = [] | append "hello world"; print $x.0"#);
|
||||
|
||||
assert_eq!(actual.out, "hello world");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mut_pipeline_allows_in() {
|
||||
let actual =
|
||||
|
|
|
@ -415,3 +415,9 @@ fn const_raw_string() {
|
|||
let actual = nu!(r#"const x = r#'abc'#; $x"#);
|
||||
assert_eq!(actual.out, "abc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn const_takes_pipeline() {
|
||||
let actual = nu!(r#"const list = 'bar_baz_quux' | split row '_'; $list | length"#);
|
||||
assert_eq!(actual.out, "3");
|
||||
}
|
||||
|
|
|
@ -295,6 +295,22 @@ fn assign_expressions() -> TestResult {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assign_takes_pipeline() -> TestResult {
|
||||
run_test(
|
||||
r#"mut foo = 'bar'; $foo = $foo | str upcase | str reverse; $foo"#,
|
||||
"RAB",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn append_assign_takes_pipeline() -> TestResult {
|
||||
run_test(
|
||||
r#"mut foo = 'bar'; $foo ++= $foo | str upcase; $foo"#,
|
||||
"barBAR",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn string_interpolation_paren_test() -> TestResult {
|
||||
run_test(r#"$"('(')(')')""#, "()")
|
||||
|
|
Loading…
Reference in New Issue
Block a user