Skip to content

Commit b291ead

Browse files
committed
z/up tracks position correctly
1 parent 1b0a54a commit b291ead

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/rewrite_clj/zip/zip_test.clj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,19 @@
4242
0 [1 8]
4343
1 [1 7]
4444
2 [1 2])
45+
46+
(tabular
47+
(fact "z/up tracks position correctly"
48+
(let [bottom (-> (base/of-string "[x [y [1]]]")
49+
z/down
50+
z/right z/right
51+
z/down
52+
z/right z/right
53+
z/down)
54+
zloc (nth (iterate z/up bottom) ?n)]
55+
(z/position zloc) => ?pos))
56+
?n ?pos
57+
0 [1 8]
58+
1 [1 7]
59+
2 [1 4]
60+
3 [1 1])

0 commit comments

Comments
 (0)