Andreas Raab uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ar.91.mcz==================== Summary ====================
Name: KernelTests-ar.91
Author: ar
Time: 3 September 2009, 11:58:19 am
UUID: d7f6b649-18fa-d748-b286-47e33f4b8c63
Ancestors: KernelTests-ar.90
http://bugs.squeak.org/view.php?id=7321Updated tests for waitTimeout.
=============== Diff against KernelTests-ar.90 ===============
Item was added:
+ ----- Method: SemaphoreTest>>testWaitTimeoutMSecs (in category 'testing') -----
+ testWaitTimeoutMSecs
+ "Ensure that waitTimeoutMSecs behaves properly"
+
+ "Ensure that a timed out waitTimeoutMSecs: returns true from the wait"
+ self assert: (Semaphore new waitTimeoutMSecs: 50) == true.
+
+ "Ensure that a signaled waitTimeoutMSecs: returns false from the wait"
+ self assert: (Semaphore new signal waitTimeoutMSecs: 50) == false.
+ !
Item was added:
+ ----- Method: SemaphoreTest>>testWaitAndWaitTimeoutTogether (in category 'testing') -----
+ testWaitAndWaitTimeoutTogether
+ | semaphore value waitProcess waitTimeoutProcess |
+ semaphore := Semaphore new.
+
+ waitProcess := [semaphore wait. value := #wait] fork.
+
+ waitTimeoutProcess := [semaphore waitTimeoutMSecs: 50. value := #waitTimeout] fork.
+
+ "Wait for the timeout to happen"
+ (Delay forMilliseconds: 100) wait.
+
+ "The waitTimeoutProcess should already have timed out. This should release the waitProcess"
+ semaphore signal.
+
+ [waitProcess isTerminated and: [waitTimeoutProcess isTerminated]]
+ whileFalse: [(Delay forMilliseconds: 100) wait].
+
+ self assert: value = #wait.
+ !