aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-20 11:44:48 +0000
committer_ov4 <ov4@ov4.org>2026-10-20 11:44:48 +0000
commitbfe2e75d7e3b372e55369677028429990c49bc54 (patch)
treeb64b0e999b428f7740c0cd2c4ec05d51a213ddd9 /tests
parenta3335110dc4f1283cf1680e273cc9775b7e8c8ac (diff)
feat(driver): embed and automatically link the standard library
Add -no-std to disable default library loading and linking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/i/no-std/case.json1
-rw-r--r--tests/i/no-std/expected.txt2
-rw-r--r--tests/i/no-std/notes.md3
-rw-r--r--tests/i/no-std/program.cps4
-rw-r--r--tests/library/exp-string/case.json2
-rw-r--r--tests/run.pl6
6 files changed, 14 insertions, 4 deletions
diff --git a/tests/i/no-std/case.json b/tests/i/no-std/case.json
new file mode 100644
index 0000000..85acec5
--- /dev/null
+++ b/tests/i/no-std/case.json
@@ -0,0 +1 @@
+{"compiler_args":["-no-std"]}
diff --git a/tests/i/no-std/expected.txt b/tests/i/no-std/expected.txt
new file mode 100644
index 0000000..1a2735d
--- /dev/null
+++ b/tests/i/no-std/expected.txt
@@ -0,0 +1,2 @@
+C literal without the standard library
+42
diff --git a/tests/i/no-std/notes.md b/tests/i/no-std/notes.md
new file mode 100644
index 0000000..8fcea00
--- /dev/null
+++ b/tests/i/no-std/notes.md
@@ -0,0 +1,3 @@
+# No standard library
+
+Human review: pending. A suffixed literal is C_STRING without loading any pseudocode library. The C puts call writes the supplied text and a newline; integer addition produces 42.
diff --git a/tests/i/no-std/program.cps b/tests/i/no-std/program.cps
new file mode 100644
index 0000000..feb369f
--- /dev/null
+++ b/tests/i/no-std/program.cps
@@ -0,0 +1,4 @@
+INCLUDE_OBJ "__libc"
+EXTERN "C" EXTERN_FUNCTION puts(C_STRING) RETURNS C_INT
+CALL puts("C literal without the standard library"C)
+OUTPUT 20 + 22
diff --git a/tests/library/exp-string/case.json b/tests/library/exp-string/case.json
index a558ad6..e1ed21a 100644
--- a/tests/library/exp-string/case.json
+++ b/tests/library/exp-string/case.json
@@ -1 +1 @@
-{"sources":["program.cps","../../../pseudocode-lib/_exp_string.cps"]}
+{"sources":["program.cps","../../../pseudocode-lib/_exp_string.cps"],"compiler_args":["-no-std"]}
diff --git a/tests/run.pl b/tests/run.pl
index 8565805..86eff4f 100644
--- a/tests/run.pl
+++ b/tests/run.pl
@@ -443,7 +443,7 @@ sub main {
write_file($target, $sentinel);
}
my $result = run_command($commands,
- [$cpsc_abs, @sources, @flags, '-o', $target], $work, '', 120);
+ [$cpsc_abs, @sources, @{$config->{compiler_args} // []}, @flags, '-o', $target], $work, '', 120);
my $preservation_error;
if ($existing && (!-f $target || read_file($target) ne $sentinel)) {
$preservation_error = 'compilation failure overwrote existing output';
@@ -541,12 +541,12 @@ sub main {
my $target = File::Spec->catfile($work,
$IS_WINDOWS ? 'program.exe' : 'program.bin');
my $compiled = run_command($commands,
- [$cpsc_abs, @sources, '-o', $target], $work, '', 120);
+ [$cpsc_abs, @sources, @{$config->{compiler_args} // []}, '-o', $target], $work, '', 120);
check_result($compiled, '');
$command = [$target];
}
else {
- $command = [$cpsc_abs, @sources, '-r'];
+ $command = [$cpsc_abs, @sources, @{$config->{compiler_args} // []}, '-r'];
}
my $exec_timeout = exists($config->{timeout}) ? $config->{timeout} + 0 : 30;
my $result = run_command($commands, $command, $work, $data, $exec_timeout);