Skip to content

Commit 98d0758

Browse files
committed
remove-and-move-left tracks current position correctly
1 parent 75407d1 commit 98d0758

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/rewrite_clj/zip/utils_test.clj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@
2626
(let [loc' (-> loc z/right remove-and-move-left)]
2727
(base/sexpr loc') => 'a
2828
(base/root-string loc') => "acd")))
29+
30+
(tabular
31+
(fact "`remove-and-move-left` tracks current position correctly"
32+
(let [root (base/of-string "[a bb ccc]")
33+
zloc (nth (iterate z/next root) ?n)]
34+
(z/position (remove-and-move-left zloc)) => ?pos))
35+
?n ?pos
36+
3 [1 3]
37+
5 [1 6]
38+
2 [1 2])

0 commit comments

Comments
 (0)