about summary refs log tree commit diff
path: root/edit.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-02-20 16:05:24 -0500
committerJune McEnroe <june@causal.agency>2022-02-20 16:05:24 -0500
commitc8b6e331de95419de72546964f6b255dccddcd93 (patch)
tree56f66055928ef9dc5abf8ab01b2d2b80e181e6a9 /edit.c
parentMove mbs out of struct Edit, use a global buffer (diff)
downloadcatgirl-c8b6e331de95419de72546964f6b255dccddcd93.tar.gz
catgirl-c8b6e331de95419de72546964f6b255dccddcd93.zip
Assert return values in edit tests
Diffstat (limited to '')
-rw-r--r--edit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/edit.c b/edit.c
index 7c24865..eb3d28d 100644
--- a/edit.c
+++ b/edit.c
@@ -206,9 +206,9 @@ int editInsert(struct Edit *e, wchar_t ch) {
 #include <string.h>
 
 static void fix(struct Edit *e, const char *str) {
-	editFn(e, EditClear);
+	assert(0 == editFn(e, EditClear));
 	for (const char *ch = str; *ch; ++ch) {
-		editInsert(e, (wchar_t)*ch);
+		assert(0 == editInsert(e, (wchar_t)*ch));
 	}
 }
 
@@ -216,13 +216,15 @@ static bool eq(struct Edit *e, const char *str1) {
 	size_t pos;
 	static size_t cap;
 	static char *buf;
-	editString(e, &buf, &cap, &pos);
+	assert(NULL != editString(e, &buf, &cap, &pos));
 	const char *str2 = &str1[strlen(str1) + 1];
 	return pos == strlen(str1)
 		&& !strncmp(buf, str1, pos)
 		&& !strcmp(&buf[pos], str2);
 }
 
+#define editFn(...) assert(0 == editFn(__VA_ARGS__))
+
 int main(void) {
 	struct Edit e = { .mode = EditEmacs };
 
7bdc2cc0757290591&follow=1'>Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe 2019-05-10Use val instead of suboptargJune McEnroe 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe