summaryrefslogtreecommitdiffstats
path: root/tests/010
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-11 06:45:18 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-11 06:45:18 -0700
commit25b5bdc5dfe62037faef8f19c070de434b660aa6 (patch)
treee19019ee59b345baf153a170f620f5912d5bdb27 /tests/010
parentd29381d5d2d9af69e954cfd9d3fd8d533003a7e2 (diff)
downloadtxr-25b5bdc5dfe62037faef8f19c070de434b660aa6.tar.gz
txr-25b5bdc5dfe62037faef8f19c070de434b660aa6.tar.bz2
txr-25b5bdc5dfe62037faef8f19c070de434b660aa6.zip
tree: replace-tree-iter function.
* tree.c (replace_tree_iter): New function. (tree_init): Register replace-tree-iter intrinsic. * tree.h (tree_init): Declared. * share/txr/stdlib/doc-syms.tl: Updated. * txr.1: Documented. * tests/010/tree.tl: New test case.
Diffstat (limited to 'tests/010')
-rw-r--r--tests/010/tree.tl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/010/tree.tl b/tests/010/tree.tl
index e3b2ce0c..ed86c076 100644
--- a/tests/010/tree.tl
+++ b/tests/010/tree.tl
@@ -103,6 +103,17 @@
(key (tree-next t1))))
(1 2 3))
+(test (let* ((t0 (tree-begin tr))
+ (t1 (progn (tree-next t0) (copy-tree-iter t0)))
+ (t2 (replace-tree-iter (tree-begin tr) t0)))
+ (tree-next t0)
+ (tree-next t0)
+ (list (key (tree-next t1))
+ (key (tree-next t1))
+ (key (tree-next t2))
+ (key (tree-next t2))))
+ (1 2 1 2))
+
(test (tree-next (tree-begin-at tr 20)) nil)
(test (tree-next (tree-begin-at #T(()) 0)) nil)