aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-18 08:04:15 +0000
committer_ov4 <ov4@ov4.org>2026-10-18 08:04:15 +0000
commit927e3fc0384c941f9ad313a28768660c3cdb1777 (patch)
treeee82bef8d8332dad79d05db87f33979f0e7eb423 /tests
parent34a4998658674411ef3b5a392483990467a5d6e2 (diff)
feat(driver): add #LIB directive hiding library lines in runtime errors
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/i/library-lines/case.json1
-rw-r--r--tests/i/library-lines/expected-stderr.txt4
-rw-r--r--tests/i/library-lines/expected.txt4
-rw-r--r--tests/i/library-lines/library.cps25
-rw-r--r--tests/i/library-lines/program.cps21
-rw-r--r--tests/iii/unknown-directive/case.json1
-rw-r--r--tests/iii/unknown-directive/program.cps1
7 files changed, 57 insertions, 0 deletions
diff --git a/tests/i/library-lines/case.json b/tests/i/library-lines/case.json
new file mode 100644
index 0000000..48c69f4
--- /dev/null
+++ b/tests/i/library-lines/case.json
@@ -0,0 +1 @@
+{"sources":["program.cps","library.cps"]}
diff --git a/tests/i/library-lines/expected-stderr.txt b/tests/i/library-lines/expected-stderr.txt
new file mode 100644
index 0000000..c58dca5
--- /dev/null
+++ b/tests/i/library-lines/expected-stderr.txt
@@ -0,0 +1,4 @@
+[Fatal] line 3: Array index out of bounds
+[Fatal] line 8: Array argument bounds [1:3] do not match the declared parameter bounds [1:2]
+[Fatal] line 13: File 'unopened' is not open
+[Fatal] line 18: Division by zero
diff --git a/tests/i/library-lines/expected.txt b/tests/i/library-lines/expected.txt
new file mode 100644
index 0000000..a2e855d
--- /dev/null
+++ b/tests/i/library-lines/expected.txt
@@ -0,0 +1,4 @@
+bounds caught
+contract caught
+file caught
+constructor caught
diff --git a/tests/i/library-lines/library.cps b/tests/i/library-lines/library.cps
new file mode 100644
index 0000000..a35a2e9
--- /dev/null
+++ b/tests/i/library-lines/library.cps
@@ -0,0 +1,25 @@
+#LIB
+PROCEDURE Check()
+ CALL Inner()
+ENDPROCEDURE
+PROCEDURE Inner()
+ DECLARE A : ARRAY[1:1] OF INTEGER
+ OUTPUT A[2]
+ENDPROCEDURE
+PROCEDURE Contract(A : ARRAY[1:2] OF INTEGER)
+ENDPROCEDURE
+PROCEDURE Bounds()
+ DECLARE L : INTEGER
+ L <- 3
+ DECLARE A : ARRAY[1:L] OF INTEGER
+ CALL Contract(A)
+ENDPROCEDURE
+PROCEDURE FileError()
+ CLOSEFILE "unopened"
+ENDPROCEDURE
+CLASS Broken
+ PROCEDURE NEW()
+ DECLARE X : INTEGER
+ X <- 1 DIV 0
+ ENDPROCEDURE
+ENDCLASS
diff --git a/tests/i/library-lines/program.cps b/tests/i/library-lines/program.cps
new file mode 100644
index 0000000..62a7675
--- /dev/null
+++ b/tests/i/library-lines/program.cps
@@ -0,0 +1,21 @@
+INCLUDE "library.cps"
+TRY
+ CALL Check()
+CATCH
+ OUTPUT "bounds caught"
+ENDTRY
+TRY
+ CALL Bounds()
+CATCH
+ OUTPUT "contract caught"
+ENDTRY
+TRY
+ CALL FileError()
+CATCH
+ OUTPUT "file caught"
+ENDTRY
+TRY
+ DECLARE X : Broken
+CATCH
+ OUTPUT "constructor caught"
+ENDTRY
diff --git a/tests/iii/unknown-directive/case.json b/tests/iii/unknown-directive/case.json
new file mode 100644
index 0000000..d593f34
--- /dev/null
+++ b/tests/iii/unknown-directive/case.json
@@ -0,0 +1 @@
+{"errors":[{"reason":"Unknown compiler directive","line":1}]}
diff --git a/tests/iii/unknown-directive/program.cps b/tests/iii/unknown-directive/program.cps
new file mode 100644
index 0000000..1def142
--- /dev/null
+++ b/tests/iii/unknown-directive/program.cps
@@ -0,0 +1 @@
+#FOO