aboutsummaryrefslogtreecommitdiff
path: root/tests/iii
diff options
context:
space:
mode:
Diffstat (limited to 'tests/iii')
-rw-r--r--tests/iii/input-invalid-targets/case.json32
-rw-r--r--tests/iii/input-invalid-targets/notes.md3
-rw-r--r--tests/iii/input-invalid-targets/program.cps22
3 files changed, 57 insertions, 0 deletions
diff --git a/tests/iii/input-invalid-targets/case.json b/tests/iii/input-invalid-targets/case.json
new file mode 100644
index 0000000..be4d749
--- /dev/null
+++ b/tests/iii/input-invalid-targets/case.json
@@ -0,0 +1,32 @@
+{
+ "errors": [
+ {
+ "reason": "Constant Limit is not a writable location",
+ "line": 16
+ },
+ {
+ "reason": "Cannot access private field Hidden of type Box",
+ "line": 17
+ },
+ {
+ "reason": "Whole array Scores is not an assignable location",
+ "line": 18
+ },
+ {
+ "reason": "INPUT is not supported for a value of type Student",
+ "line": 19
+ },
+ {
+ "reason": "INPUT is not supported for a value of type StudentPtr",
+ "line": 20
+ },
+ {
+ "reason": "INPUT is not supported for a value of type Season",
+ "line": 21
+ },
+ {
+ "reason": "INPUT is not supported for C pointer or void type C_STRING",
+ "line": 22
+ }
+ ]
+}
diff --git a/tests/iii/input-invalid-targets/notes.md b/tests/iii/input-invalid-targets/notes.md
new file mode 100644
index 0000000..b92b0cb
--- /dev/null
+++ b/tests/iii/input-invalid-targets/notes.md
@@ -0,0 +1,3 @@
+# Invalid INPUT targets
+
+Constants, private fields and whole arrays are not writable scalar locations. Whole records, enums, pseudocode pointers and C pointers remain unsupported INPUT value types. These diagnostics preserve the existing restrictions while accepting scalar array elements and public fields.
diff --git a/tests/iii/input-invalid-targets/program.cps b/tests/iii/input-invalid-targets/program.cps
new file mode 100644
index 0000000..6c5dc89
--- /dev/null
+++ b/tests/iii/input-invalid-targets/program.cps
@@ -0,0 +1,22 @@
+TYPE Student
+ DECLARE Score : INTEGER
+ENDTYPE
+CLASS Box
+ PRIVATE Hidden : INTEGER
+ENDCLASS
+TYPE StudentPtr = ^Student
+TYPE Season = (Spring, Summer)
+CONSTANT Limit = 3
+DECLARE Scores : ARRAY[1:2] OF INTEGER
+DECLARE Item : Box
+DECLARE Person : Student
+DECLARE P : StudentPtr
+DECLARE S : Season
+DECLARE Text : C_STRING
+INPUT Limit
+INPUT Item.Hidden
+INPUT Scores
+INPUT Person
+INPUT P
+INPUT S
+INPUT Text