The Inbox: Tests-jr.361.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tests-jr.361.mcz

commits-2
A new version of Tests was added to project The Inbox:
http://source.squeak.org/inbox/Tests-jr.361.mcz

==================== Summary ====================

Name: Tests-jr.361
Author: jr
Time: 22 January 2017, 2:03:39.879832 am
UUID: 198acafe-d1e1-9847-b530-bac77258f6c4
Ancestors: Tests-pre.360

add a test case for Environments-jr.69

=============== Diff against Tests-pre.360 ===============

Item was added:
+ ----- Method: EnvironmentTest>>testUnbindDoesNotDestroyImportedBindingsFromAnotherEnvironment (in category 'observation tests') -----
+ testUnbindDoesNotDestroyImportedBindingsFromAnotherEnvironment
+ "When a symbol is undeclared, the observing environments should not
+ lose a binding with the same key if that binding is actually imported from
+ self or a third environment."
+
+ | foreign foreignBinding one ownValue two three |
+ foreign := Environment withName: #Foreign.
+ foreign exportSelf.
+ foreign bind: #Griffle to: value.
+ foreignBinding := foreign associationAt: #Griffle.
+ env importSelf.
+ env import: foreign.
+ one := env bindingOf: #Griffle.
+ self assert: one == foreignBinding description: 'imported binding'.
+ self assert: one value == value description: 'imported binding'.
+
+ ownValue := Object new.
+ env bind: #Griffle to: ownValue.
+ two := env bindingOf: #Griffle.
+ self assert: one ~~ two description: 'new binding'.
+
+ foreign unbind: #Griffle.
+ self assert: nil equals: one value description: 'imported binding undeclared'.
+ three := env bindingOf: #Griffle.
+ self assert: two == three description: 'own binding unaffected'.
+ self assert: three value == ownValue description: 'own binding''s value unaffected'.!