--- a/RegressionTests__CollectionTests.st Mon Jan 09 10:23:25 2006 +0100
+++ b/RegressionTests__CollectionTests.st Mon Jan 23 22:21:35 2006 +0100
@@ -3,7 +3,7 @@
"{ NameSpace: RegressionTests }"
TestCase subclass:#CollectionTests
- instanceVariableNames:''
+ instanceVariableNames:'empty nonEmpty'
classVariableNames:''
poolDictionaries:''
category:'tests-Regression'
@@ -37,6 +37,13 @@
"Created: / 8.11.2001 / 08:17:09 / cg"
! !
+!CollectionTests methodsFor:'initialize-release'!
+
+setUp
+ empty := Set new.
+ nonEmpty := OrderedCollection with: #x
+! !
+
!CollectionTests methodsFor:'tests-dictionary'!
testDictionary01
@@ -307,6 +314,41 @@
"
! !
+!CollectionTests methodsFor:'tests-squeak'!
+
+testIfEmptyifNotEmpty
+ self assert: (empty ifEmpty: [true] ifNotEmpty: [false]).
+ self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [true]).
+ self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [:s | s first = #x])
+!
+
+testIfEmptyifNotEmptyDo
+ self assert: (empty ifEmpty: [true] ifNotEmptyDo: [:s | false]).
+ self assert: (nonEmpty ifEmpty: [false] ifNotEmptyDo: [:s | s first = #x])
+!
+
+testIfNotEmpty
+ empty ifNotEmpty: [self assert: false].
+ self assert: (nonEmpty ifNotEmpty: [self]) == self.
+ self assert: (nonEmpty ifNotEmpty: [:s | s first]) = #x
+!
+
+testIfNotEmptyDo
+ empty ifNotEmptyDo: [:s | self assert: false].
+ self assert: (nonEmpty ifNotEmptyDo: [:s | s first]) = #x
+!
+
+testIfNotEmptyDoifNotEmpty
+ self assert: (empty ifNotEmptyDo: [:s | false] ifEmpty: [true]).
+ self assert: (nonEmpty ifNotEmptyDo: [:s | s first = #x] ifEmpty: [false])
+!
+
+testIfNotEmptyifEmpty
+ self assert: (empty ifEmpty: [true] ifNotEmpty: [false]).
+ self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [true]).
+ self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [:s | s first = #x])
+! !
+
!CollectionTests::SortTestData methodsFor:'accessing'!
value