Skip to content

boolean-valued Tester.run() methods#2

Open
sbloch wants to merge 5 commits intoTesterViera:masterfrom
sbloch:master
Open

boolean-valued Tester.run() methods#2
sbloch wants to merge 5 commits intoTesterViera:masterfrom
sbloch:master

Conversation

@sbloch
Copy link
Copy Markdown

@sbloch sbloch commented Dec 29, 2012

Changed the public "runWhatever" hooks in the Tester class to return true (if there were no errors) or false (if there was at least one), so "runWhatever" can be composed with other things. Such as, for example,

junit.framework.TestCase.assertTrue (Tester.run(new Whatever()));

so failed Tester cases show up as failed JUnit cases (in IDE's that support JUnit).

This should be backwards-compatible: any code that was calling Tester.run on the assumption that it returned void should still compile and run.

Alternatively, perhaps these should return an int (the number of errors encountered), which I guess would be even more informative.

or at least one failure) rather than void.
classes.
Took out optimization that says if two objects aren't the same class,
they can't be same().
(Why does this need to be hard-coded into the Tester at all?)
"objects of different classes can't be same()", I didn't notice that
some of the comparison code assumed both objects had already been
confirmed to be the same class.  As a result, comparing an object of a
class with no fields with one of a class with fields could either pass
or crash, depending on the order.
Fix: put back in the "if (sameClass)" test, but applying only to a
smaller section of code, so it's still possible to override this rule
with same().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant