Skip to content

Commit

Permalink
Initial recurse test
Browse files Browse the repository at this point in the history
  • Loading branch information
texastoland committed Mar 26, 2024
1 parent cc19817 commit c2f4753
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions stdlib-candidate/tests/mod.nu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export module fs.nu
export module record.nu
export module recurse.nu
export module str_xpend.nu
32 changes: 32 additions & 0 deletions stdlib-candidate/tests/recurse.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std assert
use ../std-rfc recurse

const fixture = [
0
{ a: 1 }
{
b: [
2
[
[c d];
[3 4]
]
]
}
]

export def test [] {
assert equal ($fixture | recurse) [
$fixture # [0, {a: 1}, {b: [2, [[c, d]; [3, 4]]]}]
$fixture.0 # 0
$fixture.1 # {a: 1}
$fixture.1.a # 1
$fixture.2 # {b: [2, [[c, d]; [3, 4]]]}
$fixture.2.b # [2, [[c, d]; [3, 4]]]
$fixture.2.b.0 # 2
$fixture.2.b.1 # [c, d]; [3, 4]]
$fixture.2.b.1.0 # {c: 3, d: 4}
$fixture.2.b.1.0.c # 3
$fixture.2.b.1.0.d # 4
]
}

0 comments on commit c2f4753

Please sign in to comment.