aboutsummaryrefslogtreecommitdiff
path: root/stdlib/stdlib.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-11 14:23:41 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-11 14:23:41 -0400
commite7035e6a861c1d5e8a4917e31b1e8b722b54d55b (patch)
tree270eb3d1d61de7ad795472fc374aee94583aa647 /stdlib/stdlib.h
parent26476a0b41c480a5eb2c4ade835f48c70070d146 (diff)
Clean up doctest code a bit
Diffstat (limited to 'stdlib/stdlib.h')
-rw-r--r--stdlib/stdlib.h22
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);