"Nick Sabalausky" <a...@a.a> wrote in message news:h8f6pg$1q5...@digitalmars.com... > "Justin Johansson" <proc...@adam-dott-com.au> wrote in message > news:h8edsq$b9...@digitalmars.com... >> >> The idea is to keep working within D's built in unit test facility; just >> don't use assert statements in current fashion as if one fails then whole >> test stops running. > > I found that to be an enormous PITA too... > >> I can't imagine that my approach is anything new. What do other people >> do to achieve similar continuous unit testing goal? >> > > Usage: > http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/apps/tests/deferAssertTest/main.d > > Implementation (incl. some extra stuff that usage app doesn't actually > use): > http://www.dsource.org/projects/semitwist/browser/trunk/src/semitwist/util/deferAssert.d >
Output from that usage app: ---------------------------------- src\semitwist\apps\tests\deferAssertTest\main.d(37): Assert Failed (foo == 3 || foo > 5): foo is bad src\semitwist\apps\tests\deferAssertTest\main.d(39): Assert Failed (false) src\semitwist\apps\tests\deferAssertTest\main.d(40): Assert Threw (throwsException()): Exceptions are handled: Threw: object.Exception: Some exception src\semitwist\apps\tests\deferAssertTest\main.d(42): Ensure Failed: ensure foo failed Expression 'foo': Expected: _ == 3 || _ > 5 Actual: 2 src\semitwist\apps\tests\deferAssertTest\main.d(44): Ensure Failed Expression 'bar': Expected: _ == "hola" Actual: hello src\semitwist\apps\tests\deferAssertTest\main.d(46): Ensure Threw: Exceptions are handled: Expression 'throwsException()': Expected: !_ Threw: object.Exception: Some exception src\semitwist\apps\tests\deferAssertTest\main.d(47): Ensure Threw: Exceptions are handled: Expression 'false': Expected: _ == throwsException() Threw: object.Exception: Some exception src\semitwist\apps\tests\deferAssertTest\main.d(50): Ensure Throw Failed: Wrong type thrown! Statement 'throw new Object();': Expected: object.Exception Actual: object.Object: object.Object src\semitwist\apps\tests\deferAssertTest\main.d(51): Ensure Throw Failed: Wrong type thrown! Statement 'throw new Exception("Hello");': Expected: object.Object Actual: object.Exception: Hello tango.core.exception.assertexcept...@src\semitwist\util\deferassert.d(170): 9 Assert Failures ----------------------------------