[squeak-dev] The Trunk: CollectionsTests-fbs.207.mcz

Frank Shearar frank.shearar at gmail.com
Mon Nov 4 21:13:10 UTC 2013


Yes. #shouldnt:raise: is evil when you catch Error.

I deliberately didn't do that here so that reviewers could see that I
moved methods, not added some random new test.

frank

On 4 November 2013 20:56, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> While at it, there were a discussion in Pharo about shouldnt: [] raise:
> Error, and it's generally considered a poor test
> - practically nothing should raise Error, unless in the few cases when you
> create a block that should:raise:
>   so should:raise: is usefull, but shouldnt:raise: is generally useless
>   (unless maybe if you are testing an Error inhibition mechanism with a
> block that shouldNormally:raise: Error)
> - if ever, it effectively raises an Error, you have no information why
> I fully agree with this.
>
>
> 2013/11/4 <commits at source.squeak.org>
>
>> Frank Shearar uploaded a new version of CollectionsTests to project The
>> Trunk:
>> http://source.squeak.org/trunk/CollectionsTests-fbs.207.mcz
>>
>> ==================== Summary ====================
>>
>> Name: CollectionsTests-fbs.207
>> Author: fbs
>> Time: 4 November 2013, 6:31:01.83 pm
>> UUID: 4057d67b-5969-8b41-85d1-43fd39da4bb1
>> Ancestors: CollectionsTests-cmm.206
>>
>> Move collection tests where they belong.
>>
>> =============== Diff against CollectionsTests-cmm.206 ===============
>>
>> Item was added:
>> + ----- Method: ByteArrayTest>>testByteArrayLongAt (in category 'as yet
>> unclassified') -----
>> + testByteArrayLongAt
>> +       | ba value |
>> +       ba := ByteArray new: 4.
>> +       value := -1.
>> +       self shouldnt:[ba longAt: 1 put: value bigEndian: true] raise:
>> Error.
>> +       self assert: (ba longAt: 1 bigEndian: true) = value.
>> +       self shouldnt:[ba longAt: 1 put: value bigEndian: false] raise:
>> Error.
>> +       self assert: (ba longAt: 1 bigEndian: false) = value.!
>>
>> Item was added:
>> + ----- Method: DictionaryTest>>testIntegrityOfDictionaries (in category
>> 'integrity tests') -----
>> + testIntegrityOfDictionaries
>> +       #(
>> +               Dictionary
>> +               IdentityDictionary
>> +               SystemDictionary
>> +               LiteralDictionary
>> +               PluggableDictionary
>> +               WeakValueDictionary) do: [ :dictionaryClassName |
>> +                       Smalltalk at: dictionaryClassName ifPresent: [
>> :dictionaryClass |
>> +                               dictionaryClass allInstancesDo: [
>> :dictionary |
>> +                                       dictionary keysAndValuesDo: [ :key
>> :value |
>> +                                               self assert: (dictionary
>> at: key) == value ].
>> +                                       dictionary array doWithIndex: [
>> :association :index |
>> +                                       association ifNotNil: [
>> +                                              self assert: (dictionary
>> scanFor: association key) = index ] ] ] ] ]!
>>
>> Item was added:
>> + ----- Method: DictionaryTest>>testMethodDictionaries (in category
>> 'integrity tests') -----
>> + testMethodDictionaries
>> +       MethodDictionary allInstancesDo: [ :dictionary |
>> +               dictionary keysAndValuesDo: [ :key :value |
>> +                       self assert: (dictionary at: key) == value ].
>> +               1 to: dictionary basicSize do: [ :index |
>> +                       (dictionary basicAt: index)
>> +                               ifNil: [ self assert: (dictionary array
>> at: index) isNil ]
>> +                               ifNotNil: [ :key |
>> +                                       self assert: (dictionary scanFor:
>> key) = index ] ] ]!
>>
>> Item was added:
>> + ----- Method: HashedCollectionTest>>testCapacity (in category 'test -
>> integrity') -----
>> + testCapacity
>> +
>> +       | inconsistentCollections |
>> +       inconsistentCollections := HashedCollection allSubInstances
>> reject: [ :each |
>> +               each class == MethodDictionary "MethodDictionary is the
>> only HashedCollection which doesn't have prime array size"
>> +                       ifTrue: [ each capacity isPowerOfTwo ]
>> +                       ifFalse: [ each capacity isPrime ] ].
>> +       self assert: inconsistentCollections isEmpty!
>>
>> Item was added:
>> + ----- Method: ReadWriteStreamTest>>testReadWriteStreamNextNBug (in
>> category 'tests') -----
>> + testReadWriteStreamNextNBug
>> +       | aStream |
>> +       aStream := ReadWriteStream on: String new.
>> +       aStream nextPutAll: 'Hello World'.
>> +       self shouldnt:[aStream next: 5] raise: Error.!
>>
>>
>
>
>
>


More information about the Squeak-dev mailing list