Test.deploy.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. smalltalk.NodeTestRunner.klass);
  13. smalltalk.addMethod(
  14. "_runTestSuite",
  15. smalltalk.method({
  16. selector: "runTestSuite",
  17. fn: function (){
  18. var self=this;
  19. var $1,$2,$3;
  20. var suite;
  21. var worker;
  22. suite=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  23. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.TestCase || TestCase),"_allSubclasses",[]),"_select_",[(function(each){
  24. return smalltalk.send(smalltalk.send(each,"_isAbstract",[]),"_not",[]);
  25. })]),"_do_",[(function(each){
  26. return smalltalk.send(suite,"_addAll_",[smalltalk.send(each,"_buildSuite",[])]);
  27. })]);
  28. worker=smalltalk.send((smalltalk.TestSuiteRunner || TestSuiteRunner),"_on_",[suite]);
  29. smalltalk.send(smalltalk.send(worker,"_announcer",[]),"_on_do_",[(smalltalk.ResultAnnouncement || ResultAnnouncement),(function(ann){
  30. var result;
  31. result=smalltalk.send(ann,"_result",[]);
  32. result;
  33. $1=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
  34. if(smalltalk.assert($1)){
  35. 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."])]);
  36. $2=smalltalk.send(smalltalk.send(result,"_failures",[]),"_isEmpty",[]);
  37. if(! smalltalk.assert($2)){
  38. 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!"])]);
  39. };
  40. $3=smalltalk.send(smalltalk.send(result,"_errors",[]),"_isEmpty",[]);
  41. if(! smalltalk.assert($3)){
  42. return 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!"])]);
  43. };
  44. };
  45. })]);
  46. smalltalk.send(worker,"_run",[]);
  47. return self}
  48. }),
  49. smalltalk.NodeTestRunner.klass);