aboutsummaryrefslogtreecommitdiff
path: root/src/compile/doctests.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-01 13:17:43 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-01 13:17:43 -0400
commitee020c72d92c3807fa4afcd1e170d3df81688b97 (patch)
tree60d0bd641db08bab082bbbb7f10f72d29995cdfe /src/compile/doctests.c
parentc0c6fe863f8e074cbe8297b5da2a476f455b6518 (diff)
Switch to using Texts(x) instead of Texts(String(x)) when possible
Diffstat (limited to 'src/compile/doctests.c')
-rw-r--r--src/compile/doctests.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/compile/doctests.c b/src/compile/doctests.c
index 872684ed..20081ae7 100644
--- a/src/compile/doctests.c
+++ b/src/compile/doctests.c
@@ -4,7 +4,6 @@
#include "../config.h"
#include "../environment.h"
#include "../stdlib/datatypes.h"
-#include "../stdlib/print.h"
#include "../stdlib/text.h"
#include "../stdlib/util.h"
#include "../typecheck.h"
@@ -69,12 +68,12 @@ Text_t compile_doctest(env_t *env, ast_t *ast) {
if (target == assign->targets) expr_t = lhs_t;
env_t *val_scope = with_enum_scope(env, lhs_t);
Text_t val_code = compile_to_type(val_scope, value->ast, lhs_t);
- test_code = Texts(test_code, compile_type(lhs_t), " $", String(i), " = ", val_code, ";\n");
+ test_code = Texts(test_code, compile_type(lhs_t), " $", i, " = ", val_code, ";\n");
i += 1;
}
i = 1;
for (ast_list_t *target = assign->targets; target; target = target->next) {
- test_code = Texts(test_code, compile_assignment(env, target->ast, Texts("$", String(i))), ";\n");
+ test_code = Texts(test_code, compile_assignment(env, target->ast, Texts("$", i)), ";\n");
i += 1;
}
@@ -104,16 +103,16 @@ Text_t compile_doctest(env_t *env, ast_t *ast) {
if (test->expected) {
return Texts(setup, "test(", compile_type(expr_t), ", ", test_code, ", ",
compile_to_type(env, test->expected, expr_t), ", ", compile_type_info(expr_t), ", ",
- String((int64_t)(test->expr->start - test->expr->file->text)), ", ",
- String((int64_t)(test->expr->end - test->expr->file->text)), ");");
+ (int64_t)(test->expr->start - test->expr->file->text), ", ",
+ (int64_t)(test->expr->end - test->expr->file->text), ");");
} else {
if (expr_t->tag == VoidType || expr_t->tag == AbortType) {
return Texts(setup, "inspect_void(", test_code, ", ", compile_type_info(expr_t), ", ",
- String((int64_t)(test->expr->start - test->expr->file->text)), ", ",
- String((int64_t)(test->expr->end - test->expr->file->text)), ");");
+ (int64_t)(test->expr->start - test->expr->file->text), ", ",
+ (int64_t)(test->expr->end - test->expr->file->text), ");");
}
return Texts(setup, "inspect(", compile_type(expr_t), ", ", test_code, ", ", compile_type_info(expr_t), ", ",
- String((int64_t)(test->expr->start - test->expr->file->text)), ", ",
- String((int64_t)(test->expr->end - test->expr->file->text)), ");");
+ (int64_t)(test->expr->start - test->expr->file->text), ", ",
+ (int64_t)(test->expr->end - test->expr->file->text), ");");
}
}