Marcel Taeumel uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-mt.286.mcz==================== Summary ====================
Name: KernelTests-mt.286
Author: mt
Time: 31 January 2015, 6:18:24.491 pm
UUID: b7aeaa5e-4732-5343-8a30-5b7d241a2964
Ancestors: KernelTests-nice.285
new test for dynamic variables added
=============== Diff against KernelTests-nice.285 ===============
Item was changed:
----- Method: ProcessSpecificTest>>checkDynamic: (in category 'testing') -----
checkDynamic: value
+
+ self assert: value equals: TestDynamicVariable value.!
- self assert: TestDynamicVariable value = value!
Item was changed:
----- Method: ProcessSpecificTest>>checkLocal: (in category 'testing') -----
checkLocal: value
+
+ self assert: value equals: TestLocalVariable value.!
- self assert: TestLocalVariable value = value!
Item was changed:
----- Method: ProcessSpecificTest>>tearDown (in category 'running') -----
tearDown
"Make sure we don't pollute the running process' environment with the test variables"
{ TestLocalVariable. TestDynamicVariable } do: [ :each |
+ Processor activeProcess environmentRemoveKey: each ifAbsent: [] ].
+
+ TestDynamicVariable default: nil.!
- Processor activeProcess environmentRemoveKey: each ifAbsent: [] ]!
Item was added:
+ ----- Method: ProcessSpecificTest>>testDynamicVariableDefault (in category 'testing') -----
+ testDynamicVariableDefault
+
+ "Just double-check our fixture."
+ TestDynamicVariable default: #default.
+ self assert: #default equals: TestDynamicVariable default.
+
+ "Now check for default lookup out of any dynamic scope."
+ self checkDynamic: #default..
+
+ "Ignore default value by setting dynamic scope."
+ TestDynamicVariable value: #dynamic during: [
+ self checkDynamic: #dynamic].
+
+ "Out of that scope, we should fall back to the default again."
+ self checkDynamic: #default.
+
+ "...even if that default value changes."
+ TestDynamicVariable default: #anotherDefault.
+ self checkDynamic: #anotherDefault.
+ !
Item was changed:
DynamicVariable subclass: #TestDynamicVariable
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'KernelTests-Processes'!
+ TestDynamicVariable class
+ instanceVariableNames: 'defaultValue'!
!TestDynamicVariable commentStamp: 'mvl 3/13/2007 13:51' prior: 0!
TestDynamicVariable is a test class using in ProcessSpecificTest.
!
+ TestDynamicVariable class
+ instanceVariableNames: 'defaultValue'!
Item was added:
+ ----- Method: TestDynamicVariable class>>default (in category 'accessing') -----
+ default
+
+ ^ defaultValue!
Item was added:
+ ----- Method: TestDynamicVariable class>>default: (in category 'accessing') -----
+ default: anObject
+
+ defaultValue := anObject.!