test binary expression type errorchecking
I have written a simple test for binary expression type errorchecking. This test should yield two errors, since both a and b are integers and the operator requires two boolean operators.
test boolean op with int [[
public int calc() { int a; int b; return a && b; }
]] 2 errors
Two error messages are shown (see below), one on node a and one on node b (both are underlined in red), but still the testcase fails. When I change the number of expected errors to 1, the test succeeds. How can it be that two error messages give just one error?
Multiple messages:
Submitted on 1 December 2011 at 15:46
- Expression is of type int instead of type
boolean
- Expression is of type int instead of type
boolean
Issue Log
The typical reason for this is a nested list of errors. Probably you have a rule for editor-error which returns a list of two errors. This list is then collected into the list of all errors. Since your two errors are the only errors, you will get a list of a list of two errors. I assume the testing language simply counts the entries in the outer list, yielding one in this case. A simple solution is to flatten the list of errors in your editor-analyse.
This should be fixed in more recent revisions, where the testing language applies the
flatten-list
itself.
This was fixed in 1.0.1.
Log in to post comments