aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-12 02:10:10 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-12 02:10:10 -0500
commit73b79e0f69c1300b74996b9e85b4503c89954a54 (patch)
tree410bf259fac34558284bd32747cfa664a65ff3ca
parentda1081387f2ae645fece8715481385973775941d (diff)
Syntax tweak: doctest with ">>" and "= "
-rw-r--r--nextlang.h2
-rw-r--r--parse.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/nextlang.h b/nextlang.h
index 7d63659c..18e49dee 100644
--- a/nextlang.h
+++ b/nextlang.h
@@ -78,7 +78,7 @@ CORD as_cord(void *x, const char *fmt, ...);
#define say(str) puts(CORD_to_const_char_star(__cord(str)))
#define __test(src, expr, expected) do { \
CORD __result = __cord(expr); \
- say(CORD_catn(5, USE_COLOR ? "\x1b[33;1m>>>\x1b[0m " : ">>> ", src, USE_COLOR ? "\n\x1b[0;2m=\x1b[0;35m " : "\n= ", __result, "\x1b[m")); \
+ say(CORD_catn(5, USE_COLOR ? "\x1b[33;1m>>\x1b[0m " : ">> ", src, USE_COLOR ? "\n\x1b[0;2m=\x1b[0;35m " : "\n= ", __result, "\x1b[m")); \
if (expected && CORD_cmp(__result, expected)) { \
errx(1, "I expected:\n%s but got:\n%s", CORD_to_const_char_star(expected), CORD_to_const_char_star(__result)); \
} \
diff --git a/parse.c b/parse.c
index 9f70a99f..a955ce76 100644
--- a/parse.c
+++ b/parse.c
@@ -1599,12 +1599,12 @@ PARSER(parse_extern) {
PARSER(parse_doctest) {
const char *start = pos;
- if (!match(&pos, ">>>")) return NULL;
+ if (!match(&pos, ">>")) return NULL;
spaces(&pos);
ast_t *expr = expect(ctx, start, &pos, parse_statement, "I couldn't parse the expression for this doctest");
whitespace(&pos);
const char* output = NULL;
- if (match(&pos, "===")) {
+ if (match(&pos, "=")) {
spaces(&pos);
const char *output_start = pos,
*output_end = strchrnul(pos, '\n');