diff options
Diffstat (limited to 'stdlib/stdlib.h')
| -rw-r--r-- | stdlib/stdlib.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 1625dd88..93bd4a02 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -30,11 +30,21 @@ __attribute__((format(printf, 4, 5))) _Noreturn void fail_source(const char *filename, int64_t start, int64_t end, const char *fmt, ...); Text_t builtin_last_err(); void start_test(const char *filename, int64_t start, int64_t end); -void end_test(const void *expr, const TypeInfo_t *type, const char *expected); +void end_test(const void *expr, const TypeInfo_t *type); +void test_value(const void *expr, const TypeInfo_t *type, const char *expected); #define test(expr, typeinfo, expected, start, end) {\ - start_test(__SOURCE_FILE__, start, end); \ + const char *_expected = expected; \ + if (!_expected || !_expected[0]) { \ + start_test(__SOURCE_FILE__, start, end); \ + } \ auto _expr = expr; \ - end_test(&_expr, typeinfo, expected); } + if (!_expected || !_expected[0]) { \ + end_test(&_expr, typeinfo); \ + } else { \ + test_value(&_expr, typeinfo, _expected); \ + } \ +} + void say(Text_t text, bool newline); Text_t ask(Text_t prompt, bool bold, bool force_tty); _Noreturn void tomo_exit(Text_t text, int32_t status); |
