summaryrefslogtreecommitdiff
path: root/tests/piece-table.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/piece-table.scm')
-rw-r--r--tests/piece-table.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/piece-table.scm b/tests/piece-table.scm
index 19bd107..453229e 100644
--- a/tests/piece-table.scm
+++ b/tests/piece-table.scm
@@ -47,3 +47,16 @@
(piece-table-delete! table 12 1)
(test-equal "OLASOY EKAIT" (piece-table->string table))
(test-end "delete")
+
+(test-begin "for-each")
+ (define table (make-piece-table "12346890"))
+ (piece-table-insert! table 4 "5" 'normal)
+ (test-equal "123456890" (piece-table->string table))
+ (piece-table-insert! table 6 "7" 'normal)
+ (test-equal "1234567890" (piece-table->string table))
+ (piece-table-for-each table
+ (lambda (c i p)
+ (test-equal c (string-ref "1234567890" i)))
+ 0
+ 10)
+(test-end)