diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-27 14:00:16 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-27 14:00:16 +0000 |
| commit | 3d7d1d7cf8685f0d9230cd89d06017869da1c6d8 (patch) | |
| tree | 3b5ea9523e94f4193eb1a28b237f41d81a2cde03 /tests | |
| parent | a91bd145008432fb8c5d91d94ab6f50473a277f5 (diff) | |
feat(library)!: replace #LIB with __LIB source regions
Track library mode by original source line, including deferred template bodies
and automatic object cleanup. Update call lines from ordinary code and migrate
the embedded standard library to PP_DEFINE __LIB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i/library-lines/library.cps | 2 | ||||
| -rw-r--r-- | tests/i/library-regions/case.json | 6 | ||||
| -rw-r--r-- | tests/i/library-regions/expected-stderr.txt | 6 | ||||
| -rw-r--r-- | tests/i/library-regions/expected.txt | 6 | ||||
| -rw-r--r-- | tests/i/library-regions/notes.md | 5 | ||||
| -rw-r--r-- | tests/i/library-regions/program.cps | 12 | ||||
| -rw-r--r-- | tests/i/library-regions/regions.cps | 47 | ||||
| -rw-r--r-- | tests/iii/legacy-lib/case.json | 1 | ||||
| -rw-r--r-- | tests/iii/legacy-lib/program.cps | 2 |
9 files changed, 86 insertions, 1 deletions
diff --git a/tests/i/library-lines/library.cps b/tests/i/library-lines/library.cps index a35a2e9..d54f948 100644 --- a/tests/i/library-lines/library.cps +++ b/tests/i/library-lines/library.cps @@ -1,4 +1,4 @@ -#LIB +PP_DEFINE __LIB PROCEDURE Check() CALL Inner() ENDPROCEDURE diff --git a/tests/i/library-regions/case.json b/tests/i/library-regions/case.json new file mode 100644 index 0000000..9f95525 --- /dev/null +++ b/tests/i/library-regions/case.json @@ -0,0 +1,6 @@ +{ + "sources": [ + "program.cps", + "regions.cps" + ] +} diff --git a/tests/i/library-regions/expected-stderr.txt b/tests/i/library-regions/expected-stderr.txt new file mode 100644 index 0000000..89aee0f --- /dev/null +++ b/tests/i/library-regions/expected-stderr.txt @@ -0,0 +1,6 @@ +[Fatal] line 2: Division by zero +[Fatal] line 10: Division by zero +[Fatal] line 15: Division by zero +[Fatal] line 23: Division by zero +[Fatal] line 4: Division by zero +[Fatal] line 9: Division by zero diff --git a/tests/i/library-regions/expected.txt b/tests/i/library-regions/expected.txt new file mode 100644 index 0000000..b414108 --- /dev/null +++ b/tests/i/library-regions/expected.txt @@ -0,0 +1,6 @@ +1 +2 +3 +4 +5 +6 diff --git a/tests/i/library-regions/notes.md b/tests/i/library-regions/notes.md new file mode 100644 index 0000000..dbe4faf --- /dev/null +++ b/tests/i/library-regions/notes.md @@ -0,0 +1,5 @@ +# Trace notes + +Review status: pending human review. + +Mixed has an ordinary header but enables __LIB inside its body. Its first division uses the caller's line 2. After UNDEF, its own division uses regions.cps line 10 and a nested library call uses line 15. A disabled DEFINE does not enable __LIB, so the next division uses line 23. The library template retains its definition's mode during deferred emission and reports its caller's line 4. DeleteOnExit destroys its local object on return; the automatic library destructor retains the ordinary caller's line 9. Every error is caught and prints the next integer from 1 through 6. These are compiler extensions. diff --git a/tests/i/library-regions/program.cps b/tests/i/library-regions/program.cps new file mode 100644 index 0000000..315dbe6 --- /dev/null +++ b/tests/i/library-regions/program.cps @@ -0,0 +1,12 @@ +INCLUDE "regions.cps" +CALL Mixed() +TRY + CALL TemplateError<INTEGER>() +CATCH + OUTPUT 5 +ENDTRY +TRY + CALL DeleteOnExit() +CATCH + OUTPUT 6 +ENDTRY diff --git a/tests/i/library-regions/regions.cps b/tests/i/library-regions/regions.cps new file mode 100644 index 0000000..310014a --- /dev/null +++ b/tests/i/library-regions/regions.cps @@ -0,0 +1,47 @@ +PROCEDURE Mixed() +PP_DEFINE __LIB +TRY + OUTPUT 1 DIV 0 +CATCH + OUTPUT 1 +ENDTRY +PP_UNDEF __LIB +TRY + OUTPUT 1 DIV 0 +CATCH + OUTPUT 2 +ENDTRY +TRY + CALL LibraryError() +CATCH + OUTPUT 3 +ENDTRY +PP_IFDEF Never +PP_DEFINE __LIB +PP_ENDIF +TRY + OUTPUT 1 DIV 0 +CATCH + OUTPUT 4 +ENDTRY +ENDPROCEDURE +PP_DEFINE __LIB +PROCEDURE LibraryError() + CALL NestedError() +ENDPROCEDURE +PROCEDURE NestedError() + OUTPUT 1 DIV 0 +ENDPROCEDURE +TEMPLATE <T> +PROCEDURE TemplateError() + OUTPUT 1 DIV 0 +ENDPROCEDURE +CLASS DeleteError + PROCEDURE DELETE() + OUTPUT 1 DIV 0 + ENDPROCEDURE +ENDCLASS +PROCEDURE DeleteOnExit() + DECLARE X : DeleteError +ENDPROCEDURE +PP_UNDEF __LIB diff --git a/tests/iii/legacy-lib/case.json b/tests/iii/legacy-lib/case.json new file mode 100644 index 0000000..d593f34 --- /dev/null +++ b/tests/iii/legacy-lib/case.json @@ -0,0 +1 @@ +{"errors":[{"reason":"Unknown compiler directive","line":1}]} diff --git a/tests/iii/legacy-lib/program.cps b/tests/iii/legacy-lib/program.cps new file mode 100644 index 0000000..8abe9d9 --- /dev/null +++ b/tests/iii/legacy-lib/program.cps @@ -0,0 +1,2 @@ +#LIB +OUTPUT 1 |
