aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-10-23 11:38:02 +0200
committerMarc André Tanner <mat@brain-dump.org>2020-10-23 11:38:02 +0200
commit7cbe30aaccafcf550fb95d46e7de5ae6c698f406 (patch)
treed0cccd0b7cba716d6cda78b3749463ac07a867cd
parentba0cbc27ca24134166a74ba9c6795d11f2f38943 (diff)
downloadvis-7cbe30aaccafcf550fb95d46e7de5ae6c698f406.tar.gz
vis-7cbe30aaccafcf550fb95d46e7de5ae6c698f406.tar.xz
text/core: add basic undo/redo sanity check for empty file
-rw-r--r--core/text-test.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/text-test.c b/core/text-test.c
index 0eaafe3..edbf360 100644
--- a/core/text-test.c
+++ b/core/text-test.c
@@ -194,6 +194,10 @@ int main(int argc, char *argv[]) {
ok(text_iterator_byte_get(&it, &b) && b == '\0' &&
text_iterator_valid(&it), "Accessing iterator after moving back from beyond start of file");
+ ok(text_state(txt) > 0, "State on empty file");
+ ok(text_undo(txt) == EPOS && isempty(txt), "Undo on empty file");
+ ok(text_redo(txt) == EPOS && isempty(txt), "Redo on empty file");
+
char data[] = "a\nb\nc\n";
size_t data_len = strlen(data);
ok(insert(txt, 0, data), "Inserting new lines");