diff options
Diffstat (limited to 'tests/iii/class-new-errors')
| -rw-r--r-- | tests/iii/class-new-errors/case.json | 32 | ||||
| -rw-r--r-- | tests/iii/class-new-errors/program.cps | 26 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/iii/class-new-errors/case.json b/tests/iii/class-new-errors/case.json new file mode 100644 index 0000000..8ce52ed --- /dev/null +++ b/tests/iii/class-new-errors/case.json @@ -0,0 +1,32 @@ +{ + "errors": [ + { + "reason": "NEW target must have type Other", + "line": 20 + }, + { + "reason": "NEW requires a class type", + "line": 21 + }, + { + "reason": "NEW requires a class type", + "line": 22 + }, + { + "reason": "has no constructor NEW", + "line": 23 + }, + { + "reason": "Incorrect # arguments passed to Required.NEW", + "line": 24 + }, + { + "reason": "Incorrect # arguments passed to Required.NEW", + "line": 25 + }, + { + "reason": "NEW target must have type Hidden", + "line": 26 + } + ] +} diff --git a/tests/iii/class-new-errors/program.cps b/tests/iii/class-new-errors/program.cps new file mode 100644 index 0000000..3a9e9c2 --- /dev/null +++ b/tests/iii/class-new-errors/program.cps @@ -0,0 +1,26 @@ +CLASS Box + Value : INTEGER +ENDCLASS +CLASS Other + Value : INTEGER +ENDCLASS +CLASS Required + PROCEDURE NEW(Number : INTEGER) + ENDPROCEDURE +ENDCLASS +CLASS Hidden + PRIVATE PROCEDURE NEW() + ENDPROCEDURE +ENDCLASS +TYPE RecordValue + DECLARE Value : INTEGER +ENDTYPE +DECLARE B : Box +DECLARE R : Required(1) +B <- NEW Other +B <- NEW INTEGER +B <- NEW RecordValue +B <- NEW Box(1) +R <- NEW Required +R <- NEW Required() +B <- NEW Hidden |
