diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2020-10-23 11:58:27 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2020-10-23 11:58:27 +0200 |
| commit | 3e2f062c076594323b1872761c572721e8d92d31 (patch) | |
| tree | 2d0db1c923bd6929eb8a430193120cf9bb80124e | |
| parent | 7cbe30aaccafcf550fb95d46e7de5ae6c698f406 (diff) | |
| download | vis-3e2f062c076594323b1872761c572721e8d92d31.tar.gz vis-3e2f062c076594323b1872761c572721e8d92d31.tar.xz | |
text/core: test all load/save method combinations
This should trigger the re-mapping case during file save.
| -rw-r--r-- | core/text-test.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/core/text-test.c b/core/text-test.c index edbf360..0258f7a 100644 --- a/core/text-test.c +++ b/core/text-test.c @@ -132,16 +132,20 @@ int main(int argc, char *argv[]) { TEXT_SAVE_INPLACE, }; - for (size_t i = 0; i < LENGTH(save_method); i++) { - snprintf(buf, sizeof buf, "Hello World: %zu\n", i); - txt = text_load(NULL); - ok(txt && insert(txt, 0, buf) && compare(txt, buf), "Preparing to save (method %zu)", i); - ok(txt && text_save_method(txt, filename, save_method[i]), "Text save (method %zu)", i); - text_free(txt); - - txt = text_load(filename); - ok(txt && compare(txt, buf), "Verify save (method %zu)", i); - text_free(txt); + for (size_t l = 0; l < LENGTH(load_method); l++) { + for (size_t s = 0; s < LENGTH(save_method); s++) { + snprintf(buf, sizeof buf, "Hello World: (%zu, %zu)\n", l, s); + txt = text_load_method(filename, load_method[l]); + ok(txt, "Load (%zu, %zu)", l, s); + ok(txt && text_delete(txt, 0, text_size(txt)) && isempty(txt), "Empty (%zu, %zu)", l, s); + ok(txt && insert(txt, 0, buf) && compare(txt, buf), "Preparing to save (%zu, %zu)", l, s); + ok(txt && text_save_method(txt, filename, save_method[s]), "Text save (%zu, %zu)", l, s); + text_free(txt); + + txt = text_load(filename); + ok(txt && compare(txt, buf), "Verify save (%zu, %zu)", l, s); + text_free(txt); + } } int (*creation[])(const char*, const char*) = { symlink, link }; |
