summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/allocator.c4
-rw-r--r--test/buffer.c9
-rw-r--r--test/command.c19
-rw-r--r--test/container.c6
-rw-r--r--test/fake-reactor.c6
-rw-r--r--test/json.c95
-rw-r--r--test/keyboard.c21
-rw-r--r--test/main.c12
-rw-r--r--test/minibuffer.c18
-rw-r--r--test/settings.c46
-rw-r--r--test/test.h21
-rw-r--r--test/text.c12
-rw-r--r--test/undo.c8
-rw-r--r--test/utf8.c5
14 files changed, 204 insertions, 78 deletions
diff --git a/test/allocator.c b/test/allocator.c
index fe01334..96ef6df 100644
--- a/test/allocator.c
+++ b/test/allocator.c
@@ -3,7 +3,7 @@
#include "assert.h"
#include "test.h"
-void test_frame_allocator() {
+void test_frame_allocator(void) {
struct frame_allocator fa = frame_allocator_create(128);
ASSERT(fa.capacity == 128,
@@ -28,4 +28,4 @@ void test_frame_allocator() {
frame_allocator_destroy(&fa);
}
-void run_allocator_tests() { run_test(test_frame_allocator); }
+void run_allocator_tests(void) { run_test(test_frame_allocator); }
diff --git a/test/buffer.c b/test/buffer.c
index 7d879b0..efc479e 100644
--- a/test/buffer.c
+++ b/test/buffer.c
@@ -52,8 +52,8 @@ static void delete_callback(struct buffer *buffer, struct edit_location removed,
static void test_delete(void) {
struct buffer b = buffer_create("test-buffer-delete");
const char *txt = "we are adding some text\ntwo lines to be exact";
- struct location loc = buffer_add(&b, (struct location){.line = 0, .col = 0},
- (uint8_t *)txt, strlen(txt));
+ buffer_add(&b, (struct location){.line = 0, .col = 0}, (uint8_t *)txt,
+ strlen(txt));
ASSERT(buffer_line_length(&b, 0) == 23,
"Expected line 1 to be 23 chars before deletion");
@@ -132,7 +132,8 @@ static void test_char_movement(void) {
"Expected a double width char to result in a 2 column move");
next = buffer_next_char(&b, (struct location){.line = 0, .col = 16});
- uint64_t tab_width = settings_get("editor.tab-width")->value.number_value;
+ uint64_t tab_width =
+ settings_get("editor.tab-width")->value.data.number_value;
ASSERT(next.col == 16 + tab_width,
"Expected a tab to result in a move the width of a tab");
@@ -225,7 +226,7 @@ void run_buffer_tests(void) {
settings_init(10);
settings_set_default(
"editor.tab-width",
- (struct setting_value){.type = Setting_Number, .number_value = 4});
+ (struct setting_value){.type = Setting_Number, .data.number_value = 4});
run_test(test_add);
run_test(test_delete);
diff --git a/test/command.c b/test/command.c
index 8db02e0..9920895 100644
--- a/test/command.c
+++ b/test/command.c
@@ -5,7 +5,7 @@
#include "dged/hash.h"
#include "dged/hashmap.h"
-void test_command_registry_create() {
+void test_command_registry_create(void) {
struct commands cmds = command_registry_create(10);
ASSERT(HASHMAP_CAPACITY(&cmds.commands) == 10,
@@ -17,6 +17,10 @@ void test_command_registry_create() {
}
int32_t fake_command(struct command_ctx ctx, int argc, const char *argv[]) {
+ (void)ctx;
+ (void)argc;
+ (void)argv;
+
return 0;
}
@@ -33,7 +37,7 @@ struct commands single_fake_command(const char *name) {
return cmds;
}
-void test_register_command() {
+void test_register_command(void) {
struct commands cmds = command_registry_create(1);
struct command cmd = {
@@ -60,7 +64,7 @@ void test_register_command() {
command_registry_destroy(&cmds);
}
-void test_lookup_command() {
+void test_lookup_command(void) {
struct commands cmds = single_fake_command("fake");
struct command *cmd = lookup_command(&cmds, "fake");
@@ -69,7 +73,6 @@ void test_lookup_command() {
ASSERT_STR_EQ(cmd->name, "fake",
"Expected the found function to have the correct name");
- struct command *also_cmd = lookup_command_by_hash(&cmds, hash_name("fake"));
ASSERT(cmd != NULL,
"Expected to be able to look up inserted command by hash");
ASSERT_STR_EQ(cmd->name, "fake",
@@ -79,10 +82,14 @@ void test_lookup_command() {
}
int32_t failing_command(struct command_ctx ctx, int argc, const char *argv[]) {
+ (void)ctx;
+ (void)argc;
+ (void)argv;
+
return 100;
}
-void test_execute_command() {
+void test_execute_command(void) {
struct commands cmds = single_fake_command("fake");
struct command *cmd = lookup_command(&cmds, "fake");
@@ -101,7 +108,7 @@ void test_execute_command() {
command_registry_destroy(&cmds);
}
-void run_command_tests() {
+void run_command_tests(void) {
run_test(test_command_registry_create);
run_test(test_register_command);
run_test(test_lookup_command);
diff --git a/test/container.c b/test/container.c
index 8be7fc9..bfdf052 100644
--- a/test/container.c
+++ b/test/container.c
@@ -5,7 +5,7 @@
#include "assert.h"
#include "test.h"
-void test_empty_bintree() {
+void test_empty_bintree(void) {
BINTREE_ENTRY_TYPE(node, int);
BINTREE(node) tree;
@@ -29,7 +29,7 @@ void test_empty_bintree() {
BINTREE_FREE_NODES(BINTREE_ROOT(&tree), node);
}
-void test_bintree_iter() {
+void test_bintree_iter(void) {
BINTREE_ENTRY_TYPE(node, char);
BINTREE(node) tree;
BINTREE_INIT(&tree);
@@ -96,7 +96,7 @@ void test_bintree_iter() {
BINTREE_FREE_NODES(root, node);
}
-void run_container_tests() {
+void run_container_tests(void) {
run_test(test_empty_bintree);
run_test(test_bintree_iter);
}
diff --git a/test/fake-reactor.c b/test/fake-reactor.c
index aafe8a3..d3497fb 100644
--- a/test/fake-reactor.c
+++ b/test/fake-reactor.c
@@ -5,13 +5,13 @@ struct reactor {
struct fake_reactor_impl *impl;
};
-struct reactor *reactor_create() {
+struct reactor *reactor_create(void) {
return (struct reactor *)calloc(1, sizeof(struct reactor));
}
void reactor_destroy(struct reactor *reactor) { free(reactor); }
-void reactor_update(struct reactor *reactor) {}
+void reactor_update(struct reactor *reactor) { (void)reactor; }
bool reactor_poll_event(struct reactor *reactor, uint32_t ev_id) {
if (reactor->impl != NULL) {
return reactor->impl->poll_event(reactor->impl->userdata, ev_id);
@@ -32,7 +32,7 @@ uint32_t reactor_register_interest(struct reactor *reactor, int fd,
void reactor_unregister_interest(struct reactor *reactor, uint32_t ev_id) {
if (reactor->impl != NULL) {
- return reactor->impl->unregister_interest(reactor->impl->userdata, ev_id);
+ reactor->impl->unregister_interest(reactor->impl->userdata, ev_id);
}
}
diff --git a/test/json.c b/test/json.c
new file mode 100644
index 0000000..c67fc75
--- /dev/null
+++ b/test/json.c
@@ -0,0 +1,95 @@
+#include "assert.h"
+#include "test.h"
+
+#include "dged/json.h"
+
+#include <string.h>
+
+void test_empty_parse(void) {
+ struct json_result res = json_parse((uint8_t *)"", 0);
+
+ ASSERT(res.ok, "Expected empty parse to work");
+ json_destroy(&res.result.document);
+}
+
+void test_empty_array(void) {
+ struct json_result res = json_parse((uint8_t *)"[]", 2);
+
+ ASSERT(res.ok, "Expected parse of empty array to work");
+ struct json_value root = res.result.document;
+ ASSERT(root.type == Json_Array, "Expected doc root to be array");
+ ASSERT(json_array_len(root.value.array) == 0, "Expected array to be empty");
+
+ json_destroy(&root);
+}
+
+void test_array(void) {
+
+ struct json_result res = json_parse((uint8_t *)"[ 1, 2, 4 ]", 11);
+ ASSERT(res.ok, "Expected parse of number array to work");
+ struct json_value root = res.result.document;
+ ASSERT(root.type == Json_Array, "Expected doc root to be array");
+ ASSERT(json_array_len(root.value.array) == 3, "Expected array len to be 3");
+
+ json_destroy(&root);
+
+ const char *jsn = "[ \"hello\", \"world\" ]";
+ res = json_parse((uint8_t *)jsn, strlen(jsn));
+ ASSERT(res.ok, "Expected parse of string array to work");
+ root = res.result.document;
+ ASSERT(root.type == Json_Array, "Expected doc root to be array");
+ struct json_value *second = json_array_get(root.value.array, 1);
+ ASSERT(second->type == Json_String, "Expected second element to be a string");
+ ASSERT(s8cmp(second->value.string, s8("world")) == 0,
+ "Expected second string to be \"world\"");
+
+ json_destroy(&root);
+}
+
+void test_object(void) {
+ struct json_result res = json_parse((uint8_t *)"{ }", 3);
+ ASSERT(res.ok, "Expected parse of empty object to work");
+ struct json_value root = res.result.document;
+ ASSERT(root.type == Json_Object, "Expected doc root to be object");
+ ASSERT(json_len(root.value.object) == 0, "Expected empty object len to be 0");
+
+ json_destroy(&root);
+
+ const char *jsn = "{ \"name\": \"Kalle Kula\", \"age\": 33, }";
+ res = json_parse((uint8_t *)jsn, strlen(jsn));
+ ASSERT(res.ok, "Expected parse of simple object to work");
+ root = res.result.document;
+ ASSERT(root.type == Json_Object, "Expected doc root to be object");
+ ASSERT(json_contains(root.value.object, s8("name")),
+ "Expected object to contain \"name\"");
+
+ struct json_value *age = json_get(root.value.object, s8("age"));
+ ASSERT(age->type == Json_Number, "Expected age to (just?) be a number");
+ ASSERT(age->value.number == 33, "Expected age to be 33");
+
+ json_destroy(&root);
+
+ jsn = "{ \"name\": \"Kalle Kula\", \"age\": 33, \"kids\": "
+ "[ "
+ "{ \"name\": \"Sune Kula\", \"age\": 10, }, "
+ "{ \"name\": \"Suna Kula\", \"age\": 7 } "
+ "] }";
+ res = json_parse((uint8_t *)jsn, strlen(jsn));
+ ASSERT(res.ok, "Expected parse of nested object to work");
+ root = res.result.document;
+ ASSERT(root.type == Json_Object, "Expected doc root to be object");
+
+ ASSERT(json_contains(root.value.object, s8("kids")),
+ "Expected json object to contain array of kids");
+ struct json_value *kids = json_get(root.value.object, s8("kids"));
+ ASSERT(kids->type == Json_Array, "Expected kids to be array");
+
+ json_destroy(&root);
+}
+
+void run_json_tests(void) {
+ run_test(test_empty_parse);
+ run_test(test_empty_array);
+ run_test(test_array);
+ run_test(test_object);
+}
diff --git a/test/keyboard.c b/test/keyboard.c
index 64419ec..fdedf20 100644
--- a/test/keyboard.c
+++ b/test/keyboard.c
@@ -16,6 +16,8 @@ struct call_count {
};
bool fake_poll(void *userdata, uint32_t ev_id) {
+ (void)ev_id;
+
if (userdata != NULL) {
struct call_count *cc = (struct call_count *)userdata;
++cc->poll;
@@ -24,6 +26,9 @@ bool fake_poll(void *userdata, uint32_t ev_id) {
}
uint32_t fake_register_interest(void *userdata, int fd,
enum interest interest) {
+ (void)fd;
+ (void)interest;
+
if (userdata != NULL) {
struct call_count *cc = (struct call_count *)userdata;
++cc->reg;
@@ -32,6 +37,8 @@ uint32_t fake_register_interest(void *userdata, int fd,
}
void fake_unregister_interest(void *userdata, uint32_t ev_id) {
+ (void)ev_id;
+
if (userdata != NULL) {
struct call_count *cc = (struct call_count *)userdata;
++cc->unreg;
@@ -75,7 +82,7 @@ void fake_keyboard_destroy(struct fake_keyboard *kbd) {
reactor_destroy(kbd->reactor);
}
-void simple_key() {
+void simple_key(void) {
struct call_count cc = {0};
struct fake_reactor_impl fake = {
.poll_event = fake_poll,
@@ -99,7 +106,7 @@ void simple_key() {
free(upd.raw);
}
-void ctrl_key() {
+void ctrl_key(void) {
struct fake_reactor_impl fake = {
.poll_event = fake_poll,
.register_interest = fake_register_interest,
@@ -122,7 +129,7 @@ void ctrl_key() {
free(upd.raw);
}
-void meta_key() {
+void meta_key(void) {
struct fake_reactor_impl fake = {
.poll_event = fake_poll,
.register_interest = fake_register_interest,
@@ -147,7 +154,7 @@ void meta_key() {
free(upd.raw);
}
-void spec_key() {
+void spec_key(void) {
struct fake_reactor_impl fake = {
.poll_event = fake_poll,
.register_interest = fake_register_interest,
@@ -170,7 +177,7 @@ void spec_key() {
free(upd.raw);
}
-void test_utf8() {
+void test_utf8(void) {
struct fake_reactor_impl fake = {
.poll_event = fake_poll,
.register_interest = fake_register_interest,
@@ -192,7 +199,7 @@ void test_utf8() {
free(upd.raw);
}
-void test_key_equal() {
+void test_key_equal(void) {
struct key k1 = {.mod = Ctrl, .key = 'A'};
ASSERT(key_equal(&k1, &k1), "Expected key to be equal to itself");
ASSERT(key_equal_char(&k1, Ctrl, 'A'), "Expected key to be c-a");
@@ -203,7 +210,7 @@ void test_key_equal() {
"Expected yet another different key to not be the same");
}
-void run_keyboard_tests() {
+void run_keyboard_tests(void) {
run_test(simple_key);
run_test(ctrl_key);
run_test(meta_key);
diff --git a/test/main.c b/test/main.c
index dc0c2dc..29e031f 100644
--- a/test/main.c
+++ b/test/main.c
@@ -6,9 +6,12 @@
#include "test.h"
-void handle_abort() { exit(1); }
+void handle_abort(int sig) {
+ (void)sig;
+ exit(1);
+}
-int main() {
+int main(void) {
// Use a hardcoded locale to get a
// predictable env.
setlocale(LC_ALL, "en_US.UTF-8");
@@ -47,6 +50,11 @@ int main() {
printf("\n 🎁 \x1b[1;36mRunning container tests...\x1b[0m\n");
run_container_tests();
+#if defined(LSP_ENABLED)
+ printf("\n 📃 \x1b[1;36mRunning JSON tests...\x1b[0m\n");
+ run_json_tests();
+#endif
+
struct timespec elapsed;
clock_gettime(CLOCK_MONOTONIC, &elapsed);
uint64_t elapsed_nanos =
diff --git a/test/minibuffer.c b/test/minibuffer.c
index 28ee277..b4f8c05 100644
--- a/test/minibuffer.c
+++ b/test/minibuffer.c
@@ -19,7 +19,7 @@ static struct frame_allocator *g_alloc = NULL;
void *alloc_fn(size_t sz) { return frame_allocator_alloc(g_alloc, sz); }
-void init() {
+void init(void) {
if (b.name == NULL) {
settings_init(10);
timers_init();
@@ -31,7 +31,7 @@ void init() {
windows_init(100, 100, &b, &b, &bufs);
}
-void destroy() {
+void destroy(void) {
if (b.name != NULL) {
buffer_destroy(&b);
buffers_destroy(&bufs);
@@ -41,7 +41,7 @@ void destroy() {
}
}
-void test_minibuffer_echo() {
+void test_minibuffer_echo(void) {
struct buffer_view view = buffer_view_create(&b, false, false);
// TODO: how to clear this?
@@ -84,9 +84,15 @@ void test_minibuffer_echo() {
destroy();
}
-int32_t fake(struct command_ctx ctx, int argc, const char *argv[]) { return 0; }
+int32_t fake(struct command_ctx ctx, int argc, const char *argv[]) {
+ (void)ctx;
+ (void)argc;
+ (void)argv;
-void test_minibuffer_prompt() {
+ return 0;
+}
+
+void test_minibuffer_prompt(void) {
init();
ASSERT(!minibuffer_focused(),
"Minibuffer should not be focused without reason");
@@ -111,7 +117,7 @@ void test_minibuffer_prompt() {
destroy();
}
-void run_minibuffer_tests() {
+void run_minibuffer_tests(void) {
run_test(test_minibuffer_echo);
run_test(test_minibuffer_prompt);
}
diff --git a/test/settings.c b/test/settings.c
index 13d0963..1d1f192 100644
--- a/test/settings.c
+++ b/test/settings.c
@@ -5,22 +5,22 @@
#include "assert.h"
#include "test.h"
-void test_get() {
+void test_get(void) {
settings_init(10);
settings_set_default(
"my.setting",
- (struct setting_value){.type = Setting_Bool, .bool_value = false});
+ (struct setting_value){.type = Setting_Bool, .data.bool_value = false});
struct setting *s = settings_get("my.setting");
ASSERT(s != NULL, "Expected setting to exist after being inserted");
ASSERT(s->value.type == Setting_Bool,
"Expected inserted setting to have the same type when retrieved");
- ASSERT(!s->value.bool_value,
+ ASSERT(!s->value.data.bool_value,
"Expected inserted setting to have the same value when retrieved");
settings_set_default(
"other.setting",
- (struct setting_value){.type = Setting_Number, .number_value = 28});
+ (struct setting_value){.type = Setting_Number, .data.number_value = 28});
struct setting **res = NULL;
uint32_t nres = 0;
@@ -29,46 +29,48 @@ void test_get() {
ASSERT(nres == 1, "Expected to get one result back");
ASSERT(s->value.type == Setting_Bool, "Expected inserted setting to have the "
"same type when retrieved by prefix");
- ASSERT(!s->value.bool_value, "Expected inserted setting to have the same "
- "value when retrieved by prefix");
+ ASSERT(!s->value.data.bool_value,
+ "Expected inserted setting to have the same "
+ "value when retrieved by prefix");
free(res);
settings_destroy();
}
-void test_set() {
+void test_set(void) {
settings_init(10);
settings_set_default(
"my.setting",
- (struct setting_value){.type = Setting_Bool, .bool_value = false});
+ (struct setting_value){.type = Setting_Bool, .data.bool_value = false});
// test that wrong type is ignored;
- settings_set("my.setting", (struct setting_value){.type = Setting_String,
- .string_value = "bonan"});
+ settings_set("my.setting",
+ (struct setting_value){.type = Setting_String,
+ .data.string_value = "bonan"});
struct setting *s = settings_get("my.setting");
ASSERT(s != NULL, "Expected setting to exist after being inserted");
ASSERT(s->value.type == Setting_Bool,
"Expected inserted setting type to not have been changed");
- ASSERT(!s->value.bool_value,
+ ASSERT(!s->value.data.bool_value,
"Expected inserted setting value to not have been changed");
// test that correct type is indeed changed
settings_set("my.setting", (struct setting_value){.type = Setting_Bool,
- .bool_value = true});
+ .data.bool_value = true});
s = settings_get("my.setting");
ASSERT(s != NULL, "Expected setting to exist");
ASSERT(s->value.type == Setting_Bool,
"Expected inserted setting type to not have been changed");
- ASSERT(s->value.bool_value,
+ ASSERT(s->value.data.bool_value,
"Expected inserted setting value to _have_ been changed");
settings_destroy();
}
-void test_from_toml_string() {
+void test_from_toml_string(void) {
char *content = "[ languages.c]\n"
"name = \"C\"";
@@ -81,13 +83,13 @@ void test_from_toml_string() {
ASSERT(setting != NULL,
"Expected to be able to retrieve setting after parsed from string");
ASSERT(setting->value.type == Setting_String, "Expected a string setting");
- ASSERT_STR_EQ(setting->value.string_value, "C",
+ ASSERT_STR_EQ(setting->value.data.string_value, "C",
"Expected setting value to be \"C\"");
content = "sune = \"wrong";
res = settings_from_string(content, &errmsgs);
ASSERT(res >= 1, "Expected (at least) one error from invalid toml");
- for (uint32_t i = 0; i < res; ++i) {
+ for (uint32_t i = 0; i < (uint32_t)res; ++i) {
free(errmsgs[i]);
}
free(errmsgs);
@@ -95,7 +97,7 @@ void test_from_toml_string() {
content = "boll = truj";
res = settings_from_string(content, &errmsgs);
ASSERT(res >= 1, "Expected (at least) one error from an invalid bool");
- for (uint32_t i = 0; i < res; ++i) {
+ for (uint32_t i = 0; i < (uint32_t)res; ++i) {
free(errmsgs[i]);
}
free(errmsgs);
@@ -109,12 +111,12 @@ void test_from_toml_string() {
setting = settings_get("editor.show-whitespace");
ASSERT(setting != NULL,
"Expected editor.show-whitespace to be set from TOML");
- ASSERT(setting->value.bool_value,
+ ASSERT(setting->value.data.bool_value,
"Expected editor.show-whitespace to be set to true from TOML");
setting = settings_get("editor.tab-width");
ASSERT(setting != NULL, "Expected editor.tab-width to be set from TOML");
- ASSERT(setting->value.number_value == 3,
+ ASSERT(setting->value.data.number_value == 3,
"Expected editor.tab-width to be set to 3 from TOML");
content = "[languages]\n"
@@ -126,7 +128,7 @@ void test_from_toml_string() {
setting = settings_get("languages.pang.name");
ASSERT(setting != NULL,
"Expected languages.pang.name to be set through inline table");
- ASSERT_STR_EQ(setting->value.string_value, "Bom",
+ ASSERT_STR_EQ(setting->value.data.string_value, "Bom",
"Expected languages.pang.name to be \"Bom\"");
content = "multi = \"\"\"This is\n"
@@ -135,13 +137,13 @@ void test_from_toml_string() {
ASSERT(res == 0, "Expected valid TOML to parse successfully");
setting = settings_get("multi");
ASSERT(setting != NULL, "Expected multi to be set");
- ASSERT_STR_EQ(setting->value.string_value, "This is\na multiline string",
+ ASSERT_STR_EQ(setting->value.data.string_value, "This is\na multiline string",
"Expected newline to have been preserved in multiline string");
settings_destroy();
}
-void run_settings_tests() {
+void run_settings_tests(void) {
run_test(test_get);
run_test(test_set);
run_test(test_from_toml_string);
diff --git a/test/test.h b/test/test.h
index b01fde4..5b9cafc 100644
--- a/test/test.h
+++ b/test/test.h
@@ -9,15 +9,16 @@
fn(); \
printf("\033[32mok!\033[0m\n");
-void run_buffer_tests();
-void run_utf8_tests();
-void run_text_tests();
-void run_undo_tests();
-void run_command_tests();
-void run_keyboard_tests();
-void run_allocator_tests();
-void run_minibuffer_tests();
-void run_settings_tests();
-void run_container_tests();
+void run_buffer_tests(void);
+void run_utf8_tests(void);
+void run_text_tests(void);
+void run_undo_tests(void);
+void run_command_tests(void);
+void run_keyboard_tests(void);
+void run_allocator_tests(void);
+void run_minibuffer_tests(void);
+void run_settings_tests(void);
+void run_container_tests(void);
+void run_json_tests(void);
#endif
diff --git a/test/text.c b/test/text.c
index f890e7b..0d1557f 100644
--- a/test/text.c
+++ b/test/text.c
@@ -8,14 +8,14 @@
#include "stdio.h"
#include "test.h"
-void assert_line_eq(struct text_chunk line, const char *txt, const char *msg) {
+static void assert_line_eq(struct text_chunk line, const char *txt,
+ const char *msg) {
ASSERT(strncmp((const char *)line.text, txt, line.nbytes) == 0, msg);
}
-void assert_line_equal(struct text_chunk *line) {}
-
-void test_add_text() {
+void test_add_text(void) {
uint32_t lines_added;
+
/* use a silly small initial capacity to test re-alloc */
struct text *t = text_create(1);
@@ -65,7 +65,7 @@ void test_add_text() {
text_destroy(t);
}
-void test_delete_text() {
+void test_delete_text(void) {
uint32_t lines_added;
struct text *t = text_create(10);
const char *txt = "This is line 1";
@@ -128,7 +128,7 @@ void test_delete_text() {
text_destroy(t4);
}
-void run_text_tests() {
+void run_text_tests(void) {
run_test(test_add_text);
run_test(test_delete_text);
}
diff --git a/test/undo.c b/test/undo.c
index a4b6ad0..05ec2e4 100644
--- a/test/undo.c
+++ b/test/undo.c
@@ -5,7 +5,7 @@
#include "assert.h"
#include "test.h"
-void test_undo_insert() {
+void test_undo_insert(void) {
struct undo_stack undo;
/* small capacity on purpose to force re-sizing */
@@ -15,7 +15,7 @@ void test_undo_insert() {
ASSERT(undo_size(&undo) == 1,
"Expected undo stack to have one item after inserting a save point");
- undo_push_boundary(&undo, (struct undo_boundary){});
+ undo_push_boundary(&undo, (struct undo_boundary){0});
ASSERT(undo_size(&undo) == 2,
"Expected undo stack to have two items after inserting a boundary");
@@ -37,7 +37,7 @@ void test_undo_insert() {
undo_destroy(&undo);
}
-void test_undo() {
+void test_undo(void) {
struct undo_stack undo;
undo_init(&undo, 10);
@@ -99,7 +99,7 @@ void test_undo() {
undo_destroy(&undo);
}
-void run_undo_tests() {
+void run_undo_tests(void) {
run_test(test_undo_insert);
run_test(test_undo);
}
diff --git a/test/utf8.c b/test/utf8.c
index c5094c7..19a18d5 100644
--- a/test/utf8.c
+++ b/test/utf8.c
@@ -6,6 +6,5 @@
#include "assert.h"
#include "test.h"
-void test_nchars_nbytes() {}
-
-void run_utf8_tests() { run_test(test_nchars_nbytes); }
+void test_nchars_nbytes(void) {}
+void run_utf8_tests(void) { run_test(test_nchars_nbytes); }