@mv *.gcov coverage ; [ -f .gcov ] && mv .gcov coverage
@ awk '/^ *[1-9]/ {ran+=1} /^ *###/ {skip+=1} \
END {printf "coverage: %6.2f%%\n", ran * 100 / (ran + skip); \
- if (ran < (ran + skip) *0.75) exit(1) }' \
+ if (ran < (ran + skip) *0.8) exit(1) }' \
coverage/oceani.mdc.gcov
@rm -f .tmp*
single message about the first error. So this section will be fairly
thin until we add proper parsing recovery in the face of common errors.
+A special case of syntax errors is token errors, when a token is only
+accepted because the parser doesn't know quite enough to reject it.
+There are handled better as they are quite local, so a single test
+program can trigger most of the possible errors.
+
To handle erronous code, we need a different set of tests, as we need to
capture `stderr`. The same test code will be used for type errors too.
As error messages contain the line number, and we don't want changes to
###### test list
oceani_failing_tests := syn1
+ oceani_failing_tests += tokerr
###### test: syn1
###### output: syn1
.tmp.code:3:11: error: unhandled parse error: then
+###### test: tokerr
+ program:
+ a := 1i // imaginary numbers aren't understood
+ b:[2i]number // array sizes are handled separately
+ c:[3.14159]Boolean // array sizes must be integers
+ d:[1_000_000_000_000]number // they mustn't be huge
+ patn: string = "foo[ ,_]*bar"re // regexp strings are just a dream
+
+ multi := """
+ This is a multiline string
+ With an unsupportable suffix
+ """Aa
+
+ xx:unknown = 24
+ yy:[unknowable]number
+ zzsize := 4
+ zz:[zzsize]string // size must be constant, use ::=
+
+###### output: tokerr
+ .tmp.code:3:13: error: unsupported number suffix: 1i
+ .tmp.code:4:11: error: unsupported number suffix: 2i
+ .tmp.code:5:11: error: array size must be an integer: 3.14159
+ .tmp.code:6:11: error: array size is too large: 1_000_000_000_000
+ .tmp.code:7:23: error: unsupported string suffix: "foo[ ,_]*bar"re
+ .tmp.code:9:17: error: unsupported string suffix: """
+ This is a multiline string
+ With an unsupportable suffix
+ """Aa
+ .tmp.code:14:11: error: undefined type: unknown
+ .tmp.code:15:12: error: name undeclared: unknowable
+ .tmp.code:17:12: error: array size must be a constant: zzsize
## Test erroneous command line args