From 5f3fea525ded153e2ceb244b14b41bbf2afd5bc5 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 18 Jan 2024 14:46:22 +0100 Subject: 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 --- tests/piece-table.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3