mirror of
https://github.com/nushell/nushell
synced 2024-12-29 14:33:13 +00:00
Merge pull request #47 from stormasm/test_buildstring
more block param and build string tests in concert with lists
This commit is contained in:
commit
c4d1c458a2
1 changed files with 26 additions and 0 deletions
26
src/tests.rs
26
src/tests.rs
|
@ -214,6 +214,16 @@ fn block_param2() -> TestResult {
|
|||
run_test("[3] | each { |y| $y + 10 }", "[13]")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_param3_list_iteration() -> TestResult {
|
||||
run_test("[1,2,3] | each { $it + 10 }", "[11, 12, 13]")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_param4_list_iteration() -> TestResult {
|
||||
run_test("[1,2,3] | each { |y| $y + 10 }", "[11, 12, 13]")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn range_iteration1() -> TestResult {
|
||||
run_test("1..4 | each { |y| $y + 10 }", "[11, 12, 13, 14]")
|
||||
|
@ -255,6 +265,22 @@ fn build_string3() -> TestResult {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_string4() -> TestResult {
|
||||
run_test(
|
||||
"['sam','rick','pete'] | each { build-string $it ' is studying'}",
|
||||
"[sam is studying, rick is studying, pete is studying]",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn build_string5() -> TestResult {
|
||||
run_test(
|
||||
"['sam','rick','pete'] | each { |x| build-string $x ' is studying'}",
|
||||
"[sam is studying, rick is studying, pete is studying]",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cell_path_subexpr1() -> TestResult {
|
||||
run_test("([[lang, gems]; [nu, 100]]).lang", "[nu]")
|
||||
|
|
Loading…
Reference in a new issue