Test.st 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. Smalltalk current createPackage: 'Test' properties: #{}!
  2. Object subclass: #NodeTestRunner
  3. instanceVariableNames: ''
  4. package: 'Test'!
  5. !NodeTestRunner class methodsFor: 'not yet classified'!
  6. initialize
  7. self runTestSuite
  8. !
  9. runTestSuite
  10. | suite worker |
  11. suite := OrderedCollection new.
  12. (TestCase allSubclasses select: [ :each | each isAbstract not ])
  13. do: [ :each | suite addAll: each buildSuite ].
  14. worker := TestSuiteRunner on: suite.
  15. worker announcer on: ResultAnnouncement do:
  16. [ :ann | | result |
  17. result := ann result.
  18. result runs = result total ifTrue: [
  19. console log: result runs asString, ' tests run, ', result failures size asString, ' failures, ', result errors size asString, ' errors.'.
  20. result failures isEmpty ifFalse: [
  21. self throw: result failures first class name, ' >> ', result failures first selector, ' is failing!!' ].
  22. result errors isEmpty ifFalse: [
  23. self throw: result errors first class name, ' >> ', result errors first selector, ' has errors!!' ].
  24. ]].
  25. worker run
  26. ! !