summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-01-18 14:46:22 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-01-18 22:48:57 +0100
commit5f3fea525ded153e2ceb244b14b41bbf2afd5bc5 (patch)
tree8a03aecd33c3f6c652bf6852ef24f48e1cc0e5c9 /tests
parent6e062ef3fb2b18698a4c4ea3f203a544d2fa5097 (diff)
par: piece-table: add substring and rewrite ->string
Now ->string is rewritten in terms of substring, but later we'll need to rewrite this in a more generic way
Diffstat (limited to 'tests')
-rw-r--r--tests/piece-table.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/piece-table.scm b/tests/piece-table.scm
index d6c1105..317286c 100644
--- a/tests/piece-table.scm
+++ b/tests/piece-table.scm
@@ -21,6 +21,15 @@
(test-equal "HOLA910" (piece-table->string table))
(test-end "insert")
+(test-begin "substring")
+ (parameterize ((add-buffer-length 10))
+ (define table (make-piece-table "1234567890"))
+ (test-equal "1234567890" (piece-table-substring table 0 10))
+ (test-equal "67890" (piece-table-substring table 5 10))
+ (piece-table-insert! table 6 "X" 'normal)
+ (test-equal "6X78" (piece-table-substring table 5 9)))
+(test-end "substring")
+
(test-begin "delete")
(define table (make-piece-table "HOLA SOY EKAITZ"))
(piece-table-delete! table 4 1)