summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-01-18 22:25:34 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-01-18 22:48:57 +0100
commit73e28d46fd5aeb71677eec8e785029b26f6385ef (patch)
tree19696e76cc18df68591a4db237a0c9d894276a97 /tests
parent58acdc6d3a5723bf255c233393640d7f277749d8 (diff)
par: piece-table: add line accessor function
Diffstat (limited to 'tests')
-rw-r--r--tests/piece-table.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/piece-table.scm b/tests/piece-table.scm
index 317286c..19bd107 100644
--- a/tests/piece-table.scm
+++ b/tests/piece-table.scm
@@ -30,6 +30,14 @@
(test-equal "6X78" (piece-table-substring table 5 9)))
(test-end "substring")
+(test-begin "insert-newlines")
+ (parameterize ((add-buffer-length 10))
+ (define table (make-piece-table "HOLA\nADIOS"))
+ (piece-table-insert! table 4 "\nHABLAMOS" 'normal)
+ (test-equal "HOLA\nHABLAMOS\nADIOS" (piece-table->string table))
+ (test-equal (piece-table-line table 1) "HABLAMOS"))
+(test-end "insert-newlines")
+
(test-begin "delete")
(define table (make-piece-table "HOLA SOY EKAITZ"))
(piece-table-delete! table 4 1)