Browse Source

More class SUnit comments and refactorings

Nicolas Petton 12 years ago
parent
commit
4943e825ba
6 changed files with 898 additions and 802 deletions
  1. 28 20
      js/SUnit-Tests.deploy.js
  2. 30 22
      js/SUnit-Tests.js
  3. 343 318
      js/SUnit.deploy.js
  4. 387 361
      js/SUnit.js
  5. 2 2
      st/SUnit-Tests.st
  6. 108 79
      st/SUnit.st

+ 28 - 20
js/SUnit-Tests.deploy.js

@@ -135,12 +135,12 @@ return self}
 smalltalk.SUnitAsyncTest);
 
 smalltalk.addMethod(
-"_testAsyncErrorsAndFailuresWork",
+"_testAsyncErrorsAndFailures",
 smalltalk.method({
-selector: "testAsyncErrorsAndFailuresWork",
+selector: "testAsyncErrorsAndFailures",
 fn: function (){
 var self=this;
-var $1,$2;
+var $1,$2,$4,$6,$5,$3;
 var suite;
 var runner;
 var result;
@@ -156,13 +156,17 @@ smalltalk.send(self,"_assert_equals_",[["fakeError"],smalltalk.send(self,"_sorte
 smalltalk.send(self,"_assert_equals_",[["fakeErrorFailingInTearDown", "fakeFailure"],smalltalk.send(self,"_sortedSelectors_",[smalltalk.send(result,"_failures",[])])]);
 return smalltalk.send(self,"_finished",[]);
 })]);
-smalltalk.send(smalltalk.send(runner,"_announcer",[]),"_on_do_",[(smalltalk.ResultAnnouncement || ResultAnnouncement),(function(ann){
-$1=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
-if(smalltalk.assert($1)){
-$2=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
-return smalltalk.send($2,"_ifTrue_",[assertBlock]);
-};
-})]);
+$1=smalltalk.send(runner,"_announcer",[]);
+$2=(smalltalk.ResultAnnouncement || ResultAnnouncement);
+$3=(function(ann){
+$4=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
+$5=(function(){
+$6=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
+return smalltalk.send($6,"_ifTrue_",[assertBlock]);
+});
+return smalltalk.send($4,"_ifTrue_",[$5]);
+});
+smalltalk.send($1,"_on_do_",[$2,$3]);
 smalltalk.send(runner,"_run",[]);
 return self}
 }),
@@ -239,12 +243,12 @@ return self}
 smalltalk.SUnitAsyncTest);
 
 smalltalk.addMethod(
-"_testTimeoutsWork",
+"_testTimeouts",
 smalltalk.method({
-selector: "testTimeoutsWork",
+selector: "testTimeouts",
 fn: function (){
 var self=this;
-var $1,$2;
+var $1,$2,$4,$6,$5,$3;
 var suite;
 var runner;
 var result;
@@ -260,13 +264,17 @@ smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(result,"_errors",[
 smalltalk.send(self,"_assert_equals_",[["fakeMultipleGraceTimeFailing", "fakeTimeout"],smalltalk.send(self,"_sortedSelectors_",[smalltalk.send(result,"_failures",[])])]);
 return smalltalk.send(self,"_finished",[]);
 })]);
-smalltalk.send(smalltalk.send(runner,"_announcer",[]),"_on_do_",[(smalltalk.ResultAnnouncement || ResultAnnouncement),(function(ann){
-$1=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
-if(smalltalk.assert($1)){
-$2=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
-return smalltalk.send($2,"_ifTrue_",[assertBlock]);
-};
-})]);
+$1=smalltalk.send(runner,"_announcer",[]);
+$2=(smalltalk.ResultAnnouncement || ResultAnnouncement);
+$3=(function(ann){
+$4=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
+$5=(function(){
+$6=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
+return smalltalk.send($6,"_ifTrue_",[assertBlock]);
+});
+return smalltalk.send($4,"_ifTrue_",[$5]);
+});
+smalltalk.send($1,"_on_do_",[$2,$3]);
 smalltalk.send(runner,"_run",[]);
 return self}
 }),

+ 30 - 22
js/SUnit-Tests.js

@@ -180,13 +180,13 @@ referencedClasses: []
 smalltalk.SUnitAsyncTest);
 
 smalltalk.addMethod(
-"_testAsyncErrorsAndFailuresWork",
+"_testAsyncErrorsAndFailures",
 smalltalk.method({
-selector: "testAsyncErrorsAndFailuresWork",
+selector: "testAsyncErrorsAndFailures",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+var $1,$2,$4,$6,$5,$3;
 var suite;
 var runner;
 var result;
@@ -202,17 +202,21 @@ smalltalk.send(self,"_assert_equals_",[["fakeError"],smalltalk.send(self,"_sorte
 smalltalk.send(self,"_assert_equals_",[["fakeErrorFailingInTearDown", "fakeFailure"],smalltalk.send(self,"_sortedSelectors_",[smalltalk.send(result,"_failures",[])])]);
 return smalltalk.send(self,"_finished",[]);
 })]);
-smalltalk.send(smalltalk.send(runner,"_announcer",[]),"_on_do_",[(smalltalk.ResultAnnouncement || ResultAnnouncement),(function(ann){
-$1=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
-if(smalltalk.assert($1)){
-$2=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
-return smalltalk.send($2,"_ifTrue_",[assertBlock]);
-};
-})]);
+$1=smalltalk.send(runner,"_announcer",[]);
+$2=(smalltalk.ResultAnnouncement || ResultAnnouncement);
+$3=(function(ann){
+$4=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
+$5=(function(){
+$6=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
+return smalltalk.send($6,"_ifTrue_",[assertBlock]);
+});
+return smalltalk.send($4,"_ifTrue_",[$5]);
+});
+smalltalk.send($1,"_on_do_",[$2,$3]);
 smalltalk.send(runner,"_run",[]);
 return self},
 args: [],
-source: "testAsyncErrorsAndFailuresWork\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a    runner := TestSuiteRunner on: suite.\x0a    self graceTime: 200.\x0a\x09result := runner result.\x0a    assertBlock := self async: [\x0a\x09\x09self assert: #('fakeError') equals: (self sortedSelectors: result errors).\x0a\x09\x09self assert: #('fakeErrorFailingInTearDown' 'fakeFailure') equals: (self sortedSelectors: result failures).\x0a\x09\x09self finished\x0a  \x09].\x0a    runner announcer on: ResultAnnouncement do: [:ann |\x0a    \x09ann result == result  ifTrue: [ result runs = result total ifTrue: assertBlock ]].\x0a\x09runner run",
+source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a    runner := TestSuiteRunner on: suite.\x0a    self graceTime: 200.\x0a\x09result := runner result.\x0a    assertBlock := self async: [\x0a\x09\x09self assert: #('fakeError') equals: (self sortedSelectors: result errors).\x0a\x09\x09self assert: #('fakeErrorFailingInTearDown' 'fakeFailure') equals: (self sortedSelectors: result failures).\x0a\x09\x09self finished\x0a  \x09].\x0a    runner announcer on: ResultAnnouncement do: [:ann |\x0a    \x09ann result == result  ifTrue: [ result runs = result total ifTrue: assertBlock ]].\x0a\x09runner run",
 messageSends: ["collect:", "selector:", "class", "on:", "graceTime:", "result", "async:", "assert:equals:", "sortedSelectors:", "errors", "failures", "finished", "on:do:", "ifTrue:", "=", "total", "runs", "==", "announcer", "run"],
 referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"]
 }),
@@ -309,13 +313,13 @@ referencedClasses: []
 smalltalk.SUnitAsyncTest);
 
 smalltalk.addMethod(
-"_testTimeoutsWork",
+"_testTimeouts",
 smalltalk.method({
-selector: "testTimeoutsWork",
+selector: "testTimeouts",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+var $1,$2,$4,$6,$5,$3;
 var suite;
 var runner;
 var result;
@@ -331,17 +335,21 @@ smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(result,"_errors",[
 smalltalk.send(self,"_assert_equals_",[["fakeMultipleGraceTimeFailing", "fakeTimeout"],smalltalk.send(self,"_sortedSelectors_",[smalltalk.send(result,"_failures",[])])]);
 return smalltalk.send(self,"_finished",[]);
 })]);
-smalltalk.send(smalltalk.send(runner,"_announcer",[]),"_on_do_",[(smalltalk.ResultAnnouncement || ResultAnnouncement),(function(ann){
-$1=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
-if(smalltalk.assert($1)){
-$2=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
-return smalltalk.send($2,"_ifTrue_",[assertBlock]);
-};
-})]);
+$1=smalltalk.send(runner,"_announcer",[]);
+$2=(smalltalk.ResultAnnouncement || ResultAnnouncement);
+$3=(function(ann){
+$4=smalltalk.send(smalltalk.send(ann,"_result",[]),"__eq_eq",[result]);
+$5=(function(){
+$6=smalltalk.send(smalltalk.send(result,"_runs",[]),"__eq",[smalltalk.send(result,"_total",[])]);
+return smalltalk.send($6,"_ifTrue_",[assertBlock]);
+});
+return smalltalk.send($4,"_ifTrue_",[$5]);
+});
+smalltalk.send($1,"_on_do_",[$2,$3]);
 smalltalk.send(runner,"_run",[]);
 return self},
 args: [],
-source: "testTimeoutsWork\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleGraceTimeFailing' 'fakeMultipleGraceTimePassing' 'testPass') collect: [ :each | self class selector: each ].\x0a    runner := TestSuiteRunner on: suite.\x0a    self graceTime: 200.\x0a\x09result := runner result.\x0a    assertBlock := self async: [\x0a\x09\x09self assert: result errors isEmpty.\x0a\x09\x09self assert: #('fakeMultipleGraceTimeFailing' 'fakeTimeout') equals: (self sortedSelectors: result failures).\x0a\x09\x09self finished\x0a  \x09].\x0a    runner announcer on: ResultAnnouncement do: [:ann |\x0a    \x09ann result == result  ifTrue: [ result runs = result total ifTrue: assertBlock ]].\x0a\x09runner run",
+source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleGraceTimeFailing' 'fakeMultipleGraceTimePassing' 'testPass') collect: [ :each | self class selector: each ].\x0a    runner := TestSuiteRunner on: suite.\x0a    self graceTime: 200.\x0a\x09result := runner result.\x0a    assertBlock := self async: [\x0a\x09\x09self assert: result errors isEmpty.\x0a\x09\x09self assert: #('fakeMultipleGraceTimeFailing' 'fakeTimeout') equals: (self sortedSelectors: result failures).\x0a\x09\x09self finished\x0a  \x09].\x0a    runner announcer on: ResultAnnouncement do: [:ann |\x0a    \x09ann result == result  ifTrue: [ result runs = result total ifTrue: assertBlock ]].\x0a\x09runner run",
 messageSends: ["collect:", "selector:", "class", "on:", "graceTime:", "result", "async:", "assert:", "isEmpty", "errors", "assert:equals:", "sortedSelectors:", "failures", "finished", "on:do:", "ifTrue:", "=", "total", "runs", "==", "announcer", "run"],
 referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"]
 }),

+ 343 - 318
js/SUnit.deploy.js

@@ -1,154 +1,4 @@
 smalltalk.addPackage('SUnit', {});
-smalltalk.addClass('BareTestContext', smalltalk.Object, ['testCase'], 'SUnit');
-smalltalk.addMethod(
-"_execute_",
-smalltalk.method({
-selector: "execute:",
-fn: function (aBlock){
-var self=this;
-var $1,$3,$4,$2;
-var failed;
-smalltalk.send(self["@testCase"],"_context_",[self]);
-$1=(function(){
-failed=true;
-failed;
-smalltalk.send(aBlock,"_value",[]);
-failed=false;
-return failed;
-});
-$2=(function(){
-smalltalk.send(self["@testCase"],"_context_",[nil]);
-$3=smalltalk.send(failed,"_and_",[(function(){
-return smalltalk.send(self["@testCase"],"_isAsync",[]);
-})]);
-if(smalltalk.assert($3)){
-smalltalk.send(self["@testCase"],"_finished",[]);
-};
-$4=smalltalk.send(self["@testCase"],"_isAsync",[]);
-if(! smalltalk.assert($4)){
-return smalltalk.send(self["@testCase"],"_tearDown",[]);
-};
-});
-smalltalk.send($1,"_ensure_",[$2]);
-return self}
-}),
-smalltalk.BareTestContext);
-
-smalltalk.addMethod(
-"_start",
-smalltalk.method({
-selector: "start",
-fn: function (){
-var self=this;
-smalltalk.send(self,"_execute_",[(function(){
-smalltalk.send(self["@testCase"],"_setUp",[]);
-return smalltalk.send(self["@testCase"],"_performTest",[]);
-})]);
-return self}
-}),
-smalltalk.BareTestContext);
-
-smalltalk.addMethod(
-"_testCase_",
-smalltalk.method({
-selector: "testCase:",
-fn: function (aTestCase){
-var self=this;
-self["@testCase"]=aTestCase;
-return self}
-}),
-smalltalk.BareTestContext);
-
-
-smalltalk.addMethod(
-"_testCase_",
-smalltalk.method({
-selector: "testCase:",
-fn: function (aTestCase){
-var self=this;
-var $2,$3,$1;
-$2=smalltalk.send(self,"_new",[]);
-smalltalk.send($2,"_testCase_",[aTestCase]);
-$3=smalltalk.send($2,"_yourself",[]);
-$1=$3;
-return $1;
-}
-}),
-smalltalk.BareTestContext.klass);
-
-
-smalltalk.addClass('ReportingTestContext', smalltalk.BareTestContext, ['finished', 'result'], 'SUnit');
-smalltalk.addMethod(
-"_execute_",
-smalltalk.method({
-selector: "execute:",
-fn: function (aBlock){
-var self=this;
-var $1,$3,$2;
-$1=(function(){
-return smalltalk.send((function(){
-return smalltalk.send((function(){
-return smalltalk.send(self,"_execute_",[aBlock],smalltalk.BareTestContext);
-}),"_on_do_",[(smalltalk.TestFailure || TestFailure),(function(ex){
-return smalltalk.send(self["@result"],"_addFailure_",[self["@testCase"]]);
-})]);
-}),"_on_do_",[(smalltalk.Error || Error),(function(ex){
-return smalltalk.send(self["@result"],"_addError_",[self["@testCase"]]);
-})]);
-});
-$2=(function(){
-$3=smalltalk.send(self["@testCase"],"_isAsync",[]);
-if(! smalltalk.assert($3)){
-smalltalk.send(self["@result"],"_increaseRuns",[]);
-return smalltalk.send(self["@finished"],"_value",[]);
-};
-});
-smalltalk.send($1,"_ensure_",[$2]);
-return self}
-}),
-smalltalk.ReportingTestContext);
-
-smalltalk.addMethod(
-"_finished_",
-smalltalk.method({
-selector: "finished:",
-fn: function (aBlock){
-var self=this;
-self["@finished"]=aBlock;
-return self}
-}),
-smalltalk.ReportingTestContext);
-
-smalltalk.addMethod(
-"_result_",
-smalltalk.method({
-selector: "result:",
-fn: function (aTestResult){
-var self=this;
-self["@result"]=aTestResult;
-return self}
-}),
-smalltalk.ReportingTestContext);
-
-
-smalltalk.addMethod(
-"_testCase_result_finished_",
-smalltalk.method({
-selector: "testCase:result:finished:",
-fn: function (aTestCase,aTestResult,aBlock){
-var self=this;
-var $2,$3,$1;
-$2=smalltalk.send(self,"_testCase_",[aTestCase],smalltalk.BareTestContext.klass);
-smalltalk.send($2,"_result_",[aTestResult]);
-smalltalk.send($2,"_finished_",[aBlock]);
-$3=smalltalk.send($2,"_yourself",[]);
-$1=$3;
-return $1;
-}
-}),
-smalltalk.ReportingTestContext.klass);
-
-
 smalltalk.addClass('ResultAnnouncement', smalltalk.Object, ['result'], 'SUnit');
 smalltalk.addMethod(
 "_result",
@@ -156,7 +6,9 @@ smalltalk.method({
 selector: "result",
 fn: function (){
 var self=this;
-return self["@result"];
+var $1;
+$1=self["@result"];
+return $1;
 }
 }),
 smalltalk.ResultAnnouncement);
@@ -179,11 +31,10 @@ smalltalk.addMethod(
 "_assert_",
 smalltalk.method({
 selector: "assert:",
-fn: function (aBoolean) {
-    var self = this;
-    smalltalk.send(self, "_assert_description_", [aBoolean, "Assertion failed"]);
-    return self;
-}
+fn: function (aBoolean){
+var self=this;
+smalltalk.send(self,"_assert_description_",[aBoolean,"Assertion failed"]);
+return self}
 }),
 smalltalk.TestCase);
 
@@ -191,13 +42,14 @@ smalltalk.addMethod(
 "_assert_description_",
 smalltalk.method({
 selector: "assert:description:",
-fn: function (aBoolean, aString) {
-    var self = this;
-    if (!smalltalk.assert(aBoolean)) {
-        smalltalk.send(self, "_signalFailure_", [aString]);
-    }
-    return self;
-}
+fn: function (aBoolean,aString){
+var self=this;
+var $1;
+$1=aBoolean;
+if(! smalltalk.assert($1)){
+smalltalk.send(self,"_signalFailure_",[aString]);
+};
+return self}
 }),
 smalltalk.TestCase);
 
@@ -205,11 +57,11 @@ smalltalk.addMethod(
 "_assert_equals_",
 smalltalk.method({
 selector: "assert:equals:",
-fn: function (expected, actual) {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_assert_description_", [smalltalk.send(expected, "__eq", [actual]), smalltalk.send(smalltalk.send(smalltalk.send("Expected: ", "__comma", [smalltalk.send(expected, "_asString", [])]), "__comma", [" but was: "]), "__comma", [smalltalk.send(actual, "_asString", [])])]);
-    return $1;
+fn: function (expected,actual){
+var self=this;
+var $1;
+$1=smalltalk.send(self,"_assert_description_",[smalltalk.send(expected,"__eq",[actual]),smalltalk.send(smalltalk.send(smalltalk.send("Expected: ","__comma",[smalltalk.send(expected,"_asString",[])]),"__comma",[" but was: "]),"__comma",[smalltalk.send(actual,"_asString",[])])]);
+return $1;
 }
 }),
 smalltalk.TestCase);
@@ -250,11 +102,10 @@ smalltalk.addMethod(
 "_deny_",
 smalltalk.method({
 selector: "deny:",
-fn: function (aBoolean) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(aBoolean, "_not", [])]);
-    return self;
-}
+fn: function (aBoolean){
+var self=this;
+smalltalk.send(self,"_assert_",[smalltalk.send(aBoolean,"_not",[])]);
+return self}
 }),
 smalltalk.TestCase);
 
@@ -276,8 +127,10 @@ smalltalk.method({
 selector: "graceTime:",
 fn: function (millis){
 var self=this;
-if(($receiver = self["@asyncTimeout"]) == nil || $receiver == undefined){
-self["@asyncTimeout"];
+var $1;
+$1=self["@asyncTimeout"];
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
 } else {
 smalltalk.send(self["@asyncTimeout"],"_clearTimeout",[]);
 };
@@ -335,7 +188,7 @@ smalltalk.method({
 selector: "runCase",
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send((smalltalk.BareTestContext || BareTestContext),"_testCase_",[self]),"_start",[]);
+smalltalk.send(smalltalk.send((smalltalk.TestContext || TestContext),"_testCase_",[self]),"_start",[]);
 return self}
 }),
 smalltalk.TestCase);
@@ -344,9 +197,11 @@ smalltalk.addMethod(
 "_selector",
 smalltalk.method({
 selector: "selector",
-fn: function () {
-    var self = this;
-    return self['@testSelector'];
+fn: function (){
+var self=this;
+var $1;
+$1=self["@testSelector"];
+return $1;
 }
 }),
 smalltalk.TestCase);
@@ -355,11 +210,10 @@ smalltalk.addMethod(
 "_setTestSelector_",
 smalltalk.method({
 selector: "setTestSelector:",
-fn: function (aSelector) {
-    var self = this;
-    self['@testSelector'] = aSelector;
-    return self;
-}
+fn: function (aSelector){
+var self=this;
+self["@testSelector"]=aSelector;
+return self}
 }),
 smalltalk.TestCase);
 
@@ -367,10 +221,9 @@ smalltalk.addMethod(
 "_setUp",
 smalltalk.method({
 selector: "setUp",
-fn: function () {
-    var self = this;
-    return self;
-}
+fn: function (){
+var self=this;
+return self}
 }),
 smalltalk.TestCase);
 
@@ -378,11 +231,10 @@ smalltalk.addMethod(
 "_should_",
 smalltalk.method({
 selector: "should:",
-fn: function (aBlock) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(aBlock, "_value", [])]);
-    return self;
-}
+fn: function (aBlock){
+var self=this;
+smalltalk.send(self,"_assert_",[smalltalk.send(aBlock,"_value",[])]);
+return self}
 }),
 smalltalk.TestCase);
 
@@ -390,11 +242,15 @@ smalltalk.addMethod(
 "_should_raise_",
 smalltalk.method({
 selector: "should:raise:",
-fn: function (aBlock, anExceptionClass) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return false;}, "_on_do_", [anExceptionClass, function (ex) {return true;}])]);
-    return self;
-}
+fn: function (aBlock,anExceptionClass){
+var self=this;
+smalltalk.send(self,"_assert_",[smalltalk.send((function(){
+smalltalk.send(aBlock,"_value",[]);
+return false;
+}),"_on_do_",[anExceptionClass,(function(ex){
+return true;
+})])]);
+return self}
 }),
 smalltalk.TestCase);
 
@@ -402,11 +258,15 @@ smalltalk.addMethod(
 "_shouldnt_raise_",
 smalltalk.method({
 selector: "shouldnt:raise:",
-fn: function (aBlock, anExceptionClass) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return true;}, "_on_do_", [anExceptionClass, function (ex) {return false;}])]);
-    return self;
-}
+fn: function (aBlock,anExceptionClass){
+var self=this;
+smalltalk.send(self,"_assert_",[smalltalk.send((function(){
+smalltalk.send(aBlock,"_value",[]);
+return true;
+}),"_on_do_",[anExceptionClass,(function(ex){
+return false;
+})])]);
+return self}
 }),
 smalltalk.TestCase);
 
@@ -414,14 +274,13 @@ smalltalk.addMethod(
 "_signalFailure_",
 smalltalk.method({
 selector: "signalFailure:",
-fn: function (aString) {
-    var self = this;
-    var $1, $2;
-    $1 = smalltalk.send(smalltalk.TestFailure || TestFailure, "_new", []);
-    smalltalk.send($1, "_messageText_", [aString]);
-    $2 = smalltalk.send($1, "_signal", []);
-    return self;
-}
+fn: function (aString){
+var self=this;
+var $1,$2;
+$1=smalltalk.send((smalltalk.TestFailure || TestFailure),"_new",[]);
+smalltalk.send($1,"_messageText_",[aString]);
+$2=smalltalk.send($1,"_signal",[]);
+return self}
 }),
 smalltalk.TestCase);
 
@@ -429,10 +288,9 @@ smalltalk.addMethod(
 "_tearDown",
 smalltalk.method({
 selector: "tearDown",
-fn: function () {
-    var self = this;
-    return self;
-}
+fn: function (){
+var self=this;
+return self}
 }),
 smalltalk.TestCase);
 
@@ -441,16 +299,17 @@ smalltalk.addMethod(
 "_allTestSelectors",
 smalltalk.method({
 selector: "allTestSelectors",
-fn: function () {
-    var self = this;
-    var $1;
-    var selectors;
-    selectors = smalltalk.send(self, "_testSelectors", []);
-    $1 = smalltalk.send(self, "_shouldInheritSelectors", []);
-    if (smalltalk.assert($1)) {
-        smalltalk.send(selectors, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allTestSelectors", [])]);
-    }
-    return selectors;
+fn: function (){
+var self=this;
+var $1,$2;
+var selectors;
+selectors=smalltalk.send(self,"_testSelectors",[]);
+$1=smalltalk.send(self,"_shouldInheritSelectors",[]);
+if(smalltalk.assert($1)){
+smalltalk.send(selectors,"_addAll_",[smalltalk.send(smalltalk.send(self,"_superclass",[]),"_allTestSelectors",[])]);
+};
+$2=selectors;
+return $2;
 }
 }),
 smalltalk.TestCase.klass);
@@ -459,11 +318,13 @@ smalltalk.addMethod(
 "_buildSuite",
 smalltalk.method({
 selector: "buildSuite",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(self, "_allTestSelectors", []), "_collect_", [function (each) {return smalltalk.send(self, "_selector_", [each]);}]);
-    return $1;
+fn: function (){
+var self=this;
+var $1;
+$1=smalltalk.send(smalltalk.send(self,"_allTestSelectors",[]),"_collect_",[(function(each){
+return smalltalk.send(self,"_selector_",[each]);
+})]);
+return $1;
 }
 }),
 smalltalk.TestCase.klass);
@@ -472,11 +333,11 @@ smalltalk.addMethod(
 "_isAbstract",
 smalltalk.method({
 selector: "isAbstract",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
-    return $1;
+fn: function (){
+var self=this;
+var $1;
+$1=smalltalk.send(smalltalk.send(self,"_name",[]),"__eq",["TestCase"]);
+return $1;
 }
 }),
 smalltalk.TestCase.klass);
@@ -485,9 +346,11 @@ smalltalk.addMethod(
 "_lookupHierarchyRoot",
 smalltalk.method({
 selector: "lookupHierarchyRoot",
-fn: function () {
-    var self = this;
-    return smalltalk.TestCase || TestCase;
+fn: function (){
+var self=this;
+var $1;
+$1=(smalltalk.TestCase || TestCase);
+return $1;
 }
 }),
 smalltalk.TestCase.klass);
@@ -496,14 +359,14 @@ smalltalk.addMethod(
 "_selector_",
 smalltalk.method({
 selector: "selector:",
-fn: function (aSelector) {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(self, "_new", []);
-    smalltalk.send($2, "_setTestSelector_", [aSelector]);
-    $3 = smalltalk.send($2, "_yourself", []);
-    $1 = $3;
-    return $1;
+fn: function (aSelector){
+var self=this;
+var $2,$3,$1;
+$2=smalltalk.send(self,"_new",[]);
+smalltalk.send($2,"_setTestSelector_",[aSelector]);
+$3=smalltalk.send($2,"_yourself",[]);
+$1=$3;
+return $1;
 }
 }),
 smalltalk.TestCase.klass);
@@ -512,11 +375,11 @@ smalltalk.addMethod(
 "_shouldInheritSelectors",
 smalltalk.method({
 selector: "shouldInheritSelectors",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_~_eq", [smalltalk.send(self, "_lookupHierarchyRoot", [])]);
-    return $1;
+fn: function (){
+var self=this;
+var $1;
+$1=smalltalk.send(self,"_~_eq",[smalltalk.send(self,"_lookupHierarchyRoot",[])]);
+return $1;
 }
 }),
 smalltalk.TestCase.klass);
@@ -525,16 +388,168 @@ smalltalk.addMethod(
 "_testSelectors",
 smalltalk.method({
 selector: "testSelectors",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_select_", [function (each) {return smalltalk.send(each, "_match_", ["^test"]);}]);
-    return $1;
+fn: function (){
+var self=this;
+var $1;
+$1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodDictionary",[]),"_keys",[]),"_select_",[(function(each){
+return smalltalk.send(each,"_match_",["^test"]);
+})]);
+return $1;
 }
 }),
 smalltalk.TestCase.klass);
 
 
+smalltalk.addClass('TestContext', smalltalk.Object, ['testCase'], 'SUnit');
+smalltalk.addMethod(
+"_execute_",
+smalltalk.method({
+selector: "execute:",
+fn: function (aBlock){
+var self=this;
+var $1,$3,$4,$2;
+var failed;
+smalltalk.send(self["@testCase"],"_context_",[self]);
+$1=(function(){
+failed=true;
+failed;
+smalltalk.send(aBlock,"_value",[]);
+failed=false;
+return failed;
+});
+$2=(function(){
+smalltalk.send(self["@testCase"],"_context_",[nil]);
+$3=smalltalk.send(failed,"_and_",[(function(){
+return smalltalk.send(self["@testCase"],"_isAsync",[]);
+})]);
+if(smalltalk.assert($3)){
+smalltalk.send(self["@testCase"],"_finished",[]);
+};
+$4=smalltalk.send(self["@testCase"],"_isAsync",[]);
+if(! smalltalk.assert($4)){
+return smalltalk.send(self["@testCase"],"_tearDown",[]);
+};
+});
+smalltalk.send($1,"_ensure_",[$2]);
+return self}
+}),
+smalltalk.TestContext);
+
+smalltalk.addMethod(
+"_start",
+smalltalk.method({
+selector: "start",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_execute_",[(function(){
+smalltalk.send(self["@testCase"],"_setUp",[]);
+return smalltalk.send(self["@testCase"],"_performTest",[]);
+})]);
+return self}
+}),
+smalltalk.TestContext);
+
+smalltalk.addMethod(
+"_testCase_",
+smalltalk.method({
+selector: "testCase:",
+fn: function (aTestCase){
+var self=this;
+self["@testCase"]=aTestCase;
+return self}
+}),
+smalltalk.TestContext);
+
+
+smalltalk.addMethod(
+"_testCase_",
+smalltalk.method({
+selector: "testCase:",
+fn: function (aTestCase){
+var self=this;
+var $2,$3,$1;
+$2=smalltalk.send(self,"_new",[]);
+smalltalk.send($2,"_testCase_",[aTestCase]);
+$3=smalltalk.send($2,"_yourself",[]);
+$1=$3;
+return $1;
+}
+}),
+smalltalk.TestContext.klass);
+
+
+smalltalk.addClass('ReportingTestContext', smalltalk.TestContext, ['finished', 'result'], 'SUnit');
+smalltalk.addMethod(
+"_execute_",
+smalltalk.method({
+selector: "execute:",
+fn: function (aBlock){
+var self=this;
+var $1,$3,$2;
+$1=(function(){
+return smalltalk.send((function(){
+return smalltalk.send((function(){
+return smalltalk.send(self,"_execute_",[aBlock],smalltalk.TestContext);
+}),"_on_do_",[(smalltalk.TestFailure || TestFailure),(function(ex){
+return smalltalk.send(self["@result"],"_addFailure_",[self["@testCase"]]);
+})]);
+}),"_on_do_",[(smalltalk.Error || Error),(function(ex){
+return smalltalk.send(self["@result"],"_addError_",[self["@testCase"]]);
+})]);
+});
+$2=(function(){
+$3=smalltalk.send(self["@testCase"],"_isAsync",[]);
+if(! smalltalk.assert($3)){
+smalltalk.send(self["@result"],"_increaseRuns",[]);
+return smalltalk.send(self["@finished"],"_value",[]);
+};
+});
+smalltalk.send($1,"_ensure_",[$2]);
+return self}
+}),
+smalltalk.ReportingTestContext);
+
+smalltalk.addMethod(
+"_finished_",
+smalltalk.method({
+selector: "finished:",
+fn: function (aBlock){
+var self=this;
+self["@finished"]=aBlock;
+return self}
+}),
+smalltalk.ReportingTestContext);
+
+smalltalk.addMethod(
+"_result_",
+smalltalk.method({
+selector: "result:",
+fn: function (aTestResult){
+var self=this;
+self["@result"]=aTestResult;
+return self}
+}),
+smalltalk.ReportingTestContext);
+
+
+smalltalk.addMethod(
+"_testCase_result_finished_",
+smalltalk.method({
+selector: "testCase:result:finished:",
+fn: function (aTestCase,aTestResult,aBlock){
+var self=this;
+var $2,$3,$1;
+$2=smalltalk.send(self,"_testCase_",[aTestCase],smalltalk.TestContext.klass);
+smalltalk.send($2,"_result_",[aTestResult]);
+smalltalk.send($2,"_finished_",[aBlock]);
+$3=smalltalk.send($2,"_yourself",[]);
+$1=$3;
+return $1;
+}
+}),
+smalltalk.ReportingTestContext.klass);
+
+
 smalltalk.addClass('TestFailure', smalltalk.Error, [], 'SUnit');
 
 
@@ -543,11 +558,10 @@ smalltalk.addMethod(
 "_addError_",
 smalltalk.method({
 selector: "addError:",
-fn: function (anError) {
-    var self = this;
-    smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
-    return self;
-}
+fn: function (anError){
+var self=this;
+smalltalk.send(smalltalk.send(self,"_errors",[]),"_add_",[anError]);
+return self}
 }),
 smalltalk.TestResult);
 
@@ -555,11 +569,10 @@ smalltalk.addMethod(
 "_addFailure_",
 smalltalk.method({
 selector: "addFailure:",
-fn: function (aFailure) {
-    var self = this;
-    smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
-    return self;
-}
+fn: function (aFailure){
+var self=this;
+smalltalk.send(smalltalk.send(self,"_failures",[]),"_add_",[aFailure]);
+return self}
 }),
 smalltalk.TestResult);
 
@@ -567,9 +580,11 @@ smalltalk.addMethod(
 "_errors",
 smalltalk.method({
 selector: "errors",
-fn: function () {
-    var self = this;
-    return self['@errors'];
+fn: function (){
+var self=this;
+var $1;
+$1=self["@errors"];
+return $1;
 }
 }),
 smalltalk.TestResult);
@@ -578,9 +593,11 @@ smalltalk.addMethod(
 "_failures",
 smalltalk.method({
 selector: "failures",
-fn: function () {
-    var self = this;
-    return self['@failures'];
+fn: function (){
+var self=this;
+var $1;
+$1=self["@failures"];
+return $1;
 }
 }),
 smalltalk.TestResult);
@@ -589,11 +606,10 @@ smalltalk.addMethod(
 "_increaseRuns",
 smalltalk.method({
 selector: "increaseRuns",
-fn: function () {
-    var self = this;
-    self['@runs'] = smalltalk.send(self['@runs'], "__plus", [1]);
-    return self;
-}
+fn: function (){
+var self=this;
+self["@runs"]=smalltalk.send(self["@runs"],"__plus",[(1)]);
+return self}
 }),
 smalltalk.TestResult);
 
@@ -601,16 +617,15 @@ smalltalk.addMethod(
 "_initialize",
 smalltalk.method({
 selector: "initialize",
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_initialize", [], smalltalk.Object);
-    self['@timestamp'] = smalltalk.send(smalltalk.Date || Date, "_now", []);
-    self['@runs'] = 0;
-    self['@errors'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
-    self['@failures'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
-    self['@total'] = 0;
-    return self;
-}
+fn: function (){
+var self=this;
+smalltalk.send(self,"_initialize",[],smalltalk.Object);
+self["@timestamp"]=smalltalk.send((smalltalk.Date || Date),"_now",[]);
+self["@runs"]=(0);
+self["@errors"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
+self["@failures"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
+self["@total"]=(0);
+return self}
 }),
 smalltalk.TestResult);
 
@@ -618,9 +633,11 @@ smalltalk.addMethod(
 "_runs",
 smalltalk.method({
 selector: "runs",
-fn: function () {
-    var self = this;
-    return self['@runs'];
+fn: function (){
+var self=this;
+var $1;
+$1=self["@runs"];
+return $1;
 }
 }),
 smalltalk.TestResult);
@@ -629,21 +646,22 @@ smalltalk.addMethod(
 "_status",
 smalltalk.method({
 selector: "status",
-fn: function () {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []);
-    if (smalltalk.assert($2)) {
-        $3 = smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []);
-        if (smalltalk.assert($3)) {
-            $1 = "success";
-        } else {
-            $1 = "failure";
-        }
-    } else {
-        $1 = "error";
-    }
-    return $1;
+fn: function (){
+var self=this;
+var $2,$4,$3,$1;
+$2=smalltalk.send(smalltalk.send(self,"_errors",[]),"_isEmpty",[]);
+$3=(function(){
+$4=smalltalk.send(smalltalk.send(self,"_failures",[]),"_isEmpty",[]);
+if(smalltalk.assert($4)){
+return "success";
+} else {
+return "failure";
+};
+});
+$1=smalltalk.send($2,"_ifTrue_ifFalse_",[$3,(function(){
+return "error";
+})]);
+return $1;
 }
 }),
 smalltalk.TestResult);
@@ -652,9 +670,11 @@ smalltalk.addMethod(
 "_timestamp",
 smalltalk.method({
 selector: "timestamp",
-fn: function () {
-    var self = this;
-    return self['@timestamp'];
+fn: function (){
+var self=this;
+var $1;
+$1=self["@timestamp"];
+return $1;
 }
 }),
 smalltalk.TestResult);
@@ -663,9 +683,11 @@ smalltalk.addMethod(
 "_total",
 smalltalk.method({
 selector: "total",
-fn: function () {
-    var self = this;
-    return self['@total'];
+fn: function (){
+var self=this;
+var $1;
+$1=self["@total"];
+return $1;
 }
 }),
 smalltalk.TestResult);
@@ -674,11 +696,10 @@ smalltalk.addMethod(
 "_total_",
 smalltalk.method({
 selector: "total:",
-fn: function (aNumber) {
-    var self = this;
-    self['@total'] = aNumber;
-    return self;
-}
+fn: function (aNumber){
+var self=this;
+self["@total"]=aNumber;
+return self}
 }),
 smalltalk.TestResult);
 
@@ -691,7 +712,9 @@ smalltalk.method({
 selector: "announcer",
 fn: function (){
 var self=this;
-return self["@announcer"];
+var $1;
+$1=self["@announcer"];
+return $1;
 }
 }),
 smalltalk.TestSuiteRunner);
@@ -740,7 +763,9 @@ smalltalk.method({
 selector: "result",
 fn: function (){
 var self=this;
-return self["@result"];
+var $1;
+$1=self["@result"];
+return $1;
 }
 }),
 smalltalk.TestSuiteRunner);

File diff suppressed because it is too large
+ 387 - 361
js/SUnit.js


+ 2 - 2
st/SUnit-Tests.st

@@ -60,7 +60,7 @@ fakeTimeout
     (self async: [ self finished ]) valueWithTimeout: 5
 !
 
-testAsyncErrorsAndFailuresWork
+testAsyncErrorsAndFailures
 	| suite runner result assertBlock |
 	suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].
     runner := TestSuiteRunner on: suite.
@@ -103,7 +103,7 @@ testPass
     flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5
 !
 
-testTimeoutsWork
+testTimeouts
 	| suite runner result assertBlock |
 	suite := #('fakeTimeout' 'fakeMultipleGraceTimeFailing' 'fakeMultipleGraceTimePassing' 'testPass') collect: [ :each | self class selector: each ].
     runner := TestSuiteRunner on: suite.

+ 108 - 79
st/SUnit.st

@@ -1,82 +1,4 @@
 Smalltalk current createPackage: 'SUnit' properties: #{}!
-Object subclass: #BareTestContext
-	instanceVariableNames: 'testCase'
-	package: 'SUnit'!
-!BareTestContext commentStamp!
-BareTestContext governs running a particular test case.
-
-It's main added value is execute: method which runs a block
-as a part of test case (restores context, nilling it afterwards,
-cleaning/calling tearDown as appropriate for sync/async scenario).!
-
-!BareTestContext methodsFor: 'accessing'!
-
-testCase: aTestCase
-	testCase := aTestCase
-! !
-
-!BareTestContext methodsFor: 'running'!
-
-execute: aBlock
-	| failed |
-    testCase context: self.
-    [ failed := true. aBlock value. failed := false ] ensure: [
-        testCase context: nil.
-        (failed and: [testCase isAsync]) ifTrue: [ testCase finished ].
-        testCase isAsync ifFalse: [ testCase tearDown ]
-    ]
-!
-
-start
-	self execute: [ testCase setUp. testCase performTest ]
-! !
-
-!BareTestContext class methodsFor: 'instance creation'!
-
-testCase: aTestCase
-	^self new
-        testCase: aTestCase;
-        yourself
-! !
-
-BareTestContext subclass: #ReportingTestContext
-	instanceVariableNames: 'finished result'
-	package: 'SUnit'!
-!ReportingTestContext commentStamp!
-ReportingTestContext adds TestResult reporting
-to BareTestContext.
-Errors are caught and save into TestResult,
-When test case is finished (which can be later for async tests),
-a callback block is executed; this is used by TestSuiteRunner.!
-
-!ReportingTestContext methodsFor: 'accessing'!
-
-finished: aBlock
-	finished := aBlock
-!
-
-result: aTestResult
-	result := aTestResult
-! !
-
-!ReportingTestContext methodsFor: 'running'!
-
-execute: aBlock
-    [[[ super execute: aBlock ]
-    on: TestFailure do: [:ex | result addFailure: testCase]]
-    on: Error do: [:ex | result addError: testCase]]
-    ensure: [ testCase isAsync ifFalse: [ result increaseRuns. finished value ]]
-! !
-
-!ReportingTestContext class methodsFor: 'instance creation'!
-
-testCase: aTestCase result: aTestResult finished: aBlock
-	^(super testCase: aTestCase)
-        result: aTestResult;
-        finished: aBlock;
-        yourself
-! !
-
 Object subclass: #ResultAnnouncement
 	instanceVariableNames: 'result'
 	package: 'SUnit'!
@@ -94,6 +16,16 @@ result: aTestResult
 Object subclass: #TestCase
 	instanceVariableNames: 'testSelector asyncTimeout context'
 	package: 'SUnit'!
+!TestCase commentStamp!
+A TestCase is an implementation of the command pattern to run a test.  
+
+`TestCase` instances are created with the class method `#selector:`, 
+passing the symbol that names the method to be executed when the test case runs.
+
+When you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.  
+As that method develops and more `#test...` methods are added, you will find yourself refactoring temps 
+into instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.  
+As required, override `#tearDown` to nil references, release objects and deallocate.!
 
 !TestCase methodsFor: 'accessing'!
 
@@ -157,7 +89,7 @@ performTest
 runCase
 	"Runs a test case in isolated context, leaking all errors."
 
-	(BareTestContext testCase: self) start
+	(TestContext testCase: self) start
 !
 
 setUp
@@ -238,13 +170,110 @@ shouldInheritSelectors
 	^self ~= self lookupHierarchyRoot
 ! !
 
+Object subclass: #TestContext
+	instanceVariableNames: 'testCase'
+	package: 'SUnit'!
+!TestContext commentStamp!
+TestContext governs running a particular test case.
+
+It's main added value is `#execute:` method which runs a block
+as a part of test case (restores context, nilling it afterwards,
+cleaning/calling tearDown as appropriate for sync/async scenario).!
+
+!TestContext methodsFor: 'accessing'!
+
+testCase: aTestCase
+	testCase := aTestCase
+! !
+
+!TestContext methodsFor: 'running'!
+
+execute: aBlock
+	| failed |
+    testCase context: self.
+    [ failed := true. aBlock value. failed := false ] ensure: [
+        testCase context: nil.
+        (failed and: [testCase isAsync]) ifTrue: [ testCase finished ].
+        testCase isAsync ifFalse: [ testCase tearDown ]
+    ]
+!
+
+start
+	self execute: [ testCase setUp. testCase performTest ]
+! !
+
+!TestContext class methodsFor: 'instance creation'!
+
+testCase: aTestCase
+	^self new
+        testCase: aTestCase;
+        yourself
+! !
+
+TestContext subclass: #ReportingTestContext
+	instanceVariableNames: 'finished result'
+	package: 'SUnit'!
+!ReportingTestContext commentStamp!
+ReportingTestContext adds `TestResult` reporting
+to `TestContext`.
+
+Errors are caught and save into a `TestResult`,
+When test case is finished (which can be later for async tests),
+a callback block is executed; this is used by a `TestSuiteRunner`.!
+
+!ReportingTestContext methodsFor: 'accessing'!
+
+finished: aBlock
+	finished := aBlock
+!
+
+result: aTestResult
+	result := aTestResult
+! !
+
+!ReportingTestContext methodsFor: 'running'!
+
+execute: aBlock
+    [
+    	[
+        	[ super execute: aBlock ]
+    			on: TestFailure 
+                do: [:ex | result addFailure: testCase ] 
+  		]
+    		on: Error 
+            do: [:ex | result addError: testCase] 
+	]
+    	ensure: [ testCase isAsync ifFalse: [ result increaseRuns. finished value ] ]
+! !
+
+!ReportingTestContext class methodsFor: 'instance creation'!
+
+testCase: aTestCase result: aTestResult finished: aBlock
+	^(super testCase: aTestCase)
+        result: aTestResult;
+        finished: aBlock;
+        yourself
+! !
+
 Error subclass: #TestFailure
 	instanceVariableNames: ''
 	package: 'SUnit'!
+!TestFailure commentStamp!
+The test framework distinguishes between failures and errors.  
+A failure is an event whose possibiity is explicitly anticipated and checked for in an assertion, 
+whereas an error is an unanticipated problem like a division by 0 or an index out of bounds.  
+
+TestFailure is raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.!
 
 Object subclass: #TestResult
 	instanceVariableNames: 'timestamp runs errors failures total'
 	package: 'SUnit'!
+!TestResult commentStamp!
+A TestResult implements the collecting parameter pattern for running a bunch of tests.  
+
+A TestResult holds tests that have run, sorted into the result categories of passed, failures and errors.
+
+TestResult is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce!
 
 !TestResult methodsFor: 'accessing'!
 

Some files were not shown because too many files changed in this diff