Skip to content

Commit 75407d1

Browse files
committed
z/insert-left fixes the position
1 parent e114063 commit 75407d1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/rewrite_clj/zip/zip_test.clj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@
8383
(z/insert-right 'x)
8484
z/position) => [1 2])
8585

86-
(fact "z/insert-left fixes the position"
87-
(-> (base/of-string "[hello world]")
88-
z/down
89-
z/right
90-
(z/insert-left 'x)
91-
z/position) => [1 8])
86+
(tabular
87+
(fact "z/insert-left fixes the position"
88+
(let [root (base/of-string "[hello world]")
89+
zloc (nth (iterate z/right (z/down root)) ?n)]
90+
(z/position (z/insert-left zloc 'x)) => ?pos))
91+
?n ?pos
92+
0 [1 3]
93+
1 [1 8])

0 commit comments

Comments
 (0)