2
0

Test.deploy.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. smalltalk.addPackage('Test', {});
  2. smalltalk.addClass('NodeTestRunner', smalltalk.Object, [], 'Test');
  3. smalltalk.addMethod(
  4. "_initialize",
  5. smalltalk.method({
  6. selector: "initialize",
  7. fn: function () {
  8. var self = this;
  9. smalltalk.send(self, "_runTestSuite", []);
  10. return self;
  11. }
  12. }),
  13. smalltalk.NodeTestRunner.klass);
  14. smalltalk.addMethod(
  15. "_runTestSuite",
  16. smalltalk.method({
  17. selector: "runTestSuite",
  18. fn: function () {
  19. var self = this;
  20. var $1, $2;
  21. var result;
  22. result = smalltalk.send(smalltalk.TestResult || TestResult, "_new", []);
  23. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.TestCase || TestCase, "_allSubclasses", []), "_select_", [function (each) {return smalltalk.send(smalltalk.send(each, "_isAbstract", []), "_not", []);}]), "_do_", [function (each) {return smalltalk.send(smalltalk.send(each, "_buildSuite", []), "_do_", [function (suite) {return smalltalk.send(suite, "_runCaseFor_", [result]);}]);}]);
  24. smalltalk.send(console, "_log_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(result, "_runs", []), "_asString", []), "__comma", [" tests run, "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(result, "_failures", []), "_size", []), "_asString", [])]), "__comma", [" failures, "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(result, "_errors", []), "_size", []), "_asString", [])]), "__comma", [" errors."])]);
  25. $1 = smalltalk.send(smalltalk.send(result, "_failures", []), "_isEmpty", []);
  26. if (!smalltalk.assert($1)) {
  27. smalltalk.send(self, "_throw_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(result, "_failures", []), "_first", []), "_class", []), "_name", []), "__comma", [" >> "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(result, "_failures", []), "_first", []), "_selector", [])]), "__comma", [" is failing!"])]);
  28. }
  29. $2 = smalltalk.send(smalltalk.send(result, "_errors", []), "_isEmpty", []);
  30. if (!smalltalk.assert($2)) {
  31. smalltalk.send(self, "_throw_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(result, "_errors", []), "_first", []), "_class", []), "_name", []), "__comma", [" >> "]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(result, "_errors", []), "_first", []), "_selector", [])]), "__comma", [" has errors!"])]);
  32. }
  33. return self;
  34. }
  35. }),
  36. smalltalk.NodeTestRunner.klass);