Joshua Gargus uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-jcg.144.mcz==================== Summary ====================
Name: KernelTests-jcg.144
Author: jcg
Time: 5 April 2010, 12:38:59.076 am
UUID: c9c5ce11-5ae4-c045-9718-4edd2e1c467d
Ancestors: KernelTests-nice.143
PromiseTest: rudimentary tests for Promise class. The test demonstrates a bug that exists in Kernel-ar.437 and earlier.
=============== Diff against KernelTests-nice.143 ===============
Item was added:
+ TestCase subclass: #PromiseTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Processes'!
Item was added:
+ ----- Method: PromiseTest>>testMultipleResolvers (in category 'testing') -----
+ testMultipleResolvers
+ | promise sum |
+ sum := 0.
+ promise := Promise new.
+ 5 timesRepeat: [
+ promise whenResolved: [:val | sum := sum + val].
+ ].
+ promise resolveWith: 5.
+ self should: [sum = 25].
+ !
Item was added:
+ ----- Method: PromiseTest>>testChainedResolvers (in category 'testing') -----
+ testChainedResolvers
+ | promise1 promise2 result |
+ promise1 := Promise new.
+ promise2 := Promise new.
+ promise1 whenResolved: [:bool | promise2 resolveWith: bool not].
+ promise2 whenResolved: [:bool | result := bool].
+ promise1 resolveWith: false.
+ self should: [result].!
Item was added:
+ ----- Method: PromiseTest>>testSingleResolver (in category 'testing') -----
+ testSingleResolver
+ | promise sum |
+ sum := 0.
+ promise := Promise new.
+ promise whenResolved: [:val | sum := sum + val].
+ promise resolveWith: 5.
+ self should: [sum = 5].
+ !