diff options
Diffstat (limited to 'stdlib/stdlib.h')
| -rw-r--r-- | stdlib/stdlib.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 93bd4a02..1b633dff 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -29,20 +29,20 @@ _Noreturn void fail_text(Text_t message); __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); +__attribute__((nonnull)) +void start_inspect(const char *filename, int64_t start, int64_t end); +__attribute__((nonnull)) +void end_inspect(const void *expr, const TypeInfo_t *type); +#define inspect(expr, typeinfo, start, end) {\ + start_inspect(__SOURCE_FILE__, start, end); \ + auto _expr = expr; \ + end_inspect(&_expr, typeinfo); \ +} +__attribute__((nonnull)) void test_value(const void *expr, const TypeInfo_t *type, const char *expected); #define test(expr, typeinfo, expected, start, end) {\ - const char *_expected = expected; \ - if (!_expected || !_expected[0]) { \ - start_test(__SOURCE_FILE__, start, end); \ - } \ auto _expr = expr; \ - if (!_expected || !_expected[0]) { \ - end_test(&_expr, typeinfo); \ - } else { \ - test_value(&_expr, typeinfo, _expected); \ - } \ + test_value(&_expr, typeinfo, expected); \ } void say(Text_t text, bool newline); |
