Closed andresteingress closed 14 years ago
currently the generated assertion statements use custom messages. this avoids use of power assertions.
alternative approach is to use assert statements without assertion messages catch the PowerAssertionError and rethrow the assertion error with the message from the PAE
played a bit with rethrowing PAEs in groovyConsole. it is not that easy e.g. to add a prefix like 'invariant violated: ' since a power assert message has line pointers pointing at code positions. modifying a PAE message would than mean to recompute all line pointers and therefore introducing a dependency on the power assert message layout.
Add two newlines between your message and the power assert output. Looks better anyway. You could also just move the whole power assert output to the right (i.e. add spaces add the beginning of each line), but I don't think it's necessary.
fixed in master
it would be great if there would be a way to join Groovy's power asserts with gcontracts error messages - the programmer could get immediate results where the boolean expression failed.