Browse Source

Testrunner: use amberc 'main' feature (fixes #620)

Manfred Kroehnert 10 years ago
parent
commit
9f0d7f69eb
3 changed files with 90 additions and 15 deletions
  1. 1 0
      Gruntfile.js
  2. 88 14
      test/Test.js
  3. 1 1
      test/Test.st

+ 1 - 0
Gruntfile.js

@@ -74,6 +74,7 @@ module.exports = function(grunt) {
         'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
         'SUnit', 'Importer-Exporter',
         'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'],
+        main_class: 'NodeTestRunner',
         output_name: 'test/amber_test_runner'
       },
       amber_cli: {

+ 88 - 14
test/Test.js

@@ -6,15 +6,15 @@ smalltalk.addClass('NodeTestRunner', smalltalk.Object, [], 'Test');
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "initialize",
+selector: "main",
 category: 'not yet classified',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 self._runTestSuite();
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.NodeTestRunner.klass)})},
+return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.NodeTestRunner.klass)})},
 args: [],
-source: "initialize\x0a\x09self runTestSuite",
+source: "main\x0a\x09self runTestSuite",
 messageSends: ["runTestSuite"],
 referencedClasses: []
 }),
@@ -32,7 +32,7 @@ function $TestCase(){return smalltalk.TestCase||(typeof TestCase=="undefined"?ni
 function $TestSuiteRunner(){return smalltalk.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
 function $ResultAnnouncement(){return smalltalk.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3;
+var $2,$1,$3,$10,$9,$8,$13,$12,$11,$7,$6,$16,$15,$14,$5,$4,$18,$17,$20,$19,$27,$26,$25,$24,$23,$30,$29,$28,$22,$21,$32,$31,$34,$33,$41,$40,$39,$38,$37,$44,$43,$42,$36,$35;
 suite=_st($OrderedCollection())._new();
 _st(_st(_st($TestCase())._allSubclasses())._select_((function(each){
 return smalltalk.withContext(function($ctx2) {
@@ -47,18 +47,92 @@ var result;
 return smalltalk.withContext(function($ctx2) {
 result=_st(ann)._result();
 result;
-$1=_st(_st(result)._runs()).__eq(_st(result)._total());
+$2=_st(result)._runs();
+$ctx2.sendIdx["runs"]=1;
+$1=_st($2).__eq(_st(result)._total());
 if(smalltalk.assert($1)){
-_st(console)._log_(_st(_st(_st(_st(_st(_st(_st(result)._runs())._asString()).__comma(" tests run, ")).__comma(_st(_st(_st(result)._failures())._size())._asString())).__comma(" failures, ")).__comma(_st(_st(_st(result)._errors())._size())._asString())).__comma(" errors."));
-$2=_st(_st(result)._failures())._isEmpty();
-if(! smalltalk.assert($2)){
-_st(_st(_st(result)._failures())._first())._runCase();
-self._throw_(_st(_st(_st(_st(_st(_st(_st(result)._failures())._first())._class())._name()).__comma(" >> ")).__comma(_st(_st(_st(result)._failures())._first())._selector())).__comma(" is failing!"));
+$3=console;
+$10=_st(result)._runs();
+$9=_st($10)._asString();
+$ctx2.sendIdx["asString"]=1;
+$8=_st($9).__comma(" tests run, ");
+$ctx2.sendIdx[","]=5;
+$13=_st(result)._failures();
+$ctx2.sendIdx["failures"]=1;
+$12=_st($13)._size();
+$ctx2.sendIdx["size"]=1;
+$11=_st($12)._asString();
+$ctx2.sendIdx["asString"]=2;
+$7=_st($8).__comma($11);
+$ctx2.sendIdx[","]=4;
+$6=_st($7).__comma(" failures, ");
+$ctx2.sendIdx[","]=3;
+$16=_st(result)._errors();
+$ctx2.sendIdx["errors"]=1;
+$15=_st($16)._size();
+$14=_st($15)._asString();
+$5=_st($6).__comma($14);
+$ctx2.sendIdx[","]=2;
+$4=_st($5).__comma(" errors.");
+$ctx2.sendIdx[","]=1;
+_st($3)._log_($4);
+$18=_st(result)._failures();
+$ctx2.sendIdx["failures"]=2;
+$17=_st($18)._isEmpty();
+$ctx2.sendIdx["isEmpty"]=1;
+if(! smalltalk.assert($17)){
+$20=_st(result)._failures();
+$ctx2.sendIdx["failures"]=3;
+$19=_st($20)._first();
+$ctx2.sendIdx["first"]=1;
+_st($19)._runCase();
+$ctx2.sendIdx["runCase"]=1;
+$27=_st(result)._failures();
+$ctx2.sendIdx["failures"]=4;
+$26=_st($27)._first();
+$ctx2.sendIdx["first"]=2;
+$25=_st($26)._class();
+$ctx2.sendIdx["class"]=1;
+$24=_st($25)._name();
+$ctx2.sendIdx["name"]=1;
+$23=_st($24).__comma(" >> ");
+$ctx2.sendIdx[","]=8;
+$30=_st(result)._failures();
+$29=_st($30)._first();
+$ctx2.sendIdx["first"]=3;
+$28=_st($29)._selector();
+$ctx2.sendIdx["selector"]=1;
+$22=_st($23).__comma($28);
+$ctx2.sendIdx[","]=7;
+$21=_st($22).__comma(" is failing!");
+$ctx2.sendIdx[","]=6;
+self._throw_($21);
+$ctx2.sendIdx["throw:"]=1;
 };
-$3=_st(_st(result)._errors())._isEmpty();
-if(! smalltalk.assert($3)){
-_st(_st(_st(result)._errors())._first())._runCase();
-return self._throw_(_st(_st(_st(_st(_st(_st(_st(result)._errors())._first())._class())._name()).__comma(" >> ")).__comma(_st(_st(_st(result)._errors())._first())._selector())).__comma(" has errors!"));
+$32=_st(result)._errors();
+$ctx2.sendIdx["errors"]=2;
+$31=_st($32)._isEmpty();
+if(! smalltalk.assert($31)){
+$34=_st(result)._errors();
+$ctx2.sendIdx["errors"]=3;
+$33=_st($34)._first();
+$ctx2.sendIdx["first"]=4;
+_st($33)._runCase();
+$41=_st(result)._errors();
+$ctx2.sendIdx["errors"]=4;
+$40=_st($41)._first();
+$ctx2.sendIdx["first"]=5;
+$39=_st($40)._class();
+$38=_st($39)._name();
+$37=_st($38).__comma(" >> ");
+$44=_st(result)._errors();
+$43=_st($44)._first();
+$42=_st($43)._selector();
+$36=_st($37).__comma($42);
+$ctx2.sendIdx[","]=10;
+$35=_st($36).__comma(" has errors!");
+$ctx2.sendIdx[","]=9;
+return self._throw_($35);
 };
 };
 }, function($ctx2) {$ctx2.fillBlock({ann:ann,result:result},$ctx1,3)})}));

+ 1 - 1
test/Test.st

@@ -5,7 +5,7 @@ Object subclass: #NodeTestRunner
 
 !NodeTestRunner class methodsFor: 'not yet classified'!
 
-initialize
+main
 	self runTestSuite
 !