From 97e3b53e8ed8537144f6e50c2581e140452c6abc Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 15 Apr 2010 13:01:37 +0200 Subject: [PATCH 1/4] SUnit: Initialize errors, failures and passed in the initialize method This is needed to help merging the Pharo changes on SUnit as the passed and errors selector were redefined to collect the information from two other selectors. --- packages/sunit/ChangeLog | 5 +++++ packages/sunit/SUnit.st | 21 ++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/sunit/ChangeLog b/packages/sunit/ChangeLog index a4daee6..2d319a9 100644 --- a/packages/sunit/ChangeLog +++ b/packages/sunit/ChangeLog @@ -1,3 +1,8 @@ +2010-04-15 Holger Hans Peter Freyther + + * packages/sunit/SUnit.st: Allocate passed, errors and failures + of TestResult inside the #initialize. + 2009-10-31 Paolo Bonzini * packages/sunit/SUnit.st: Set null logging when running #debug. diff --git a/packages/sunit/SUnit.st b/packages/sunit/SUnit.st index e21e9ca..004627e 100644 --- a/packages/sunit/SUnit.st +++ b/packages/sunit/SUnit.st @@ -300,7 +300,6 @@ This is a Collecting Parameter for the running of a bunch of tests. TestResult i errors [ - errors isNil ifTrue: [errors := Set new]. ^errors ] @@ -311,13 +310,11 @@ This is a Collecting Parameter for the running of a bunch of tests. TestResult i failures [ - failures isNil ifTrue: [failures := Set new]. ^failures ] passed [ - passed isNil ifTrue: [passed := OrderedCollection new]. ^passed ] @@ -334,9 +331,9 @@ This is a Collecting Parameter for the running of a bunch of tests. TestResult i tests [ ^(OrderedCollection new: self runCount) - addAll: self passed; - addAll: self errors; - addAll: self failures; + addAll: passed; + addAll: errors; + addAll: failures; yourself ] @@ -372,7 +369,9 @@ This is a Collecting Parameter for the running of a bunch of tests. TestResult i initialize [ - + errors := Set new. + failures := Set new. + passed := OrderedCollection new. ] runCase: aTestCase [ @@ -385,16 +384,16 @@ This is a Collecting Parameter for the running of a bunch of tests. TestResult i true] sunitOn: self class failure do: [:signal | - self failures add: aTestCase. + failures add: aTestCase. signal sunitExitWith: false]] sunitOn: self class error do: [:signal | - (self errors includes: aTestCase) ifFalse: [aTestCase logError: signal]. - self errors add: aTestCase. + (errors includes: aTestCase) ifFalse: [aTestCase logError: signal]. + errors add: aTestCase. signal sunitExitWith: false]. aTestCase logPolicy flush. - testCasePassed ifTrue: [self passed add: aTestCase] + testCasePassed ifTrue: [passed add: aTestCase] ] printOn: aStream [ -- 1.7.0.4