The Inbox: Tests-jr.362.mcz

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

The Inbox: Tests-jr.362.mcz

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

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

Name: Tests-jr.362
Author: jr
Time: 22 January 2017, 2:18:34.010832 am
UUID: 67cd6b66-44de-774a-bfea-625e0c50d00a
Ancestors: Tests-jr.361

add another test for Environments-jr.69

This time about not altering other environments when unbinding a symbol.

=============== Diff against Tests-jr.361 ===============

Item was added:
+ ----- Method: EnvironmentTest>>testUnbindDoesNotAlterImportedBindings (in category 'observation tests') -----
+ testUnbindDoesNotAlterImportedBindings
+ "When attempting to unbind a symbol, do not alter bindings outside of the envrionments'
+ own declarations."
+
+ | foreign foreignBinding one two |
+ foreign := Environment withName: #Foreign.
+ foreign exportSelf.
+ foreign bind: #Griffle to: value.
+ foreignBinding := foreign associationAt: #Griffle.
+ env at: #Griffle put: Object new.
+ env importSelf.
+ env import: foreign.
+ one := env bindingOf: #Griffle.
+ self assert: one == foreignBinding description: 'imported binding'.
+
+ env unbind: #Griffle.
+ two := env bindingOf: #Griffle.
+ self assert: value equals: foreignBinding value description: 'imported value unaffacted'.
+ self assert: two == foreignBinding description: 'imported binding still in place'.!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tests-jr.362.mcz

Jakob Reschke-2
It is clearly debatable whether keeping the imported binding (last
line) is the correct solution. After all the statement was #unbind:
...

2017-01-22 2:18 GMT+01:00 [hidden email] <[hidden email]>:

> A new version of Tests was added to project The Inbox:
> http://source.squeak.org/inbox/Tests-jr.362.mcz
>
> ==================== Summary ====================
>
> Name: Tests-jr.362
> Author: jr
> Time: 22 January 2017, 2:18:34.010832 am
> UUID: 67cd6b66-44de-774a-bfea-625e0c50d00a
> Ancestors: Tests-jr.361
>
> add another test for Environments-jr.69
>
> This time about not altering other environments when unbinding a symbol.
>
> =============== Diff against Tests-jr.361 ===============
>
> Item was added:
> + ----- Method: EnvironmentTest>>testUnbindDoesNotAlterImportedBindings (in category 'observation tests') -----
> + testUnbindDoesNotAlterImportedBindings
> +       "When attempting to unbind a symbol, do not alter bindings outside of the envrionments'
> +       own declarations."
> +
> +       | foreign foreignBinding one two |
> +       foreign := Environment withName: #Foreign.
> +       foreign exportSelf.
> +       foreign bind: #Griffle to: value.
> +       foreignBinding := foreign associationAt: #Griffle.
> +       env at: #Griffle put: Object new.
> +       env importSelf.
> +       env import: foreign.
> +       one := env bindingOf: #Griffle.
> +       self assert: one == foreignBinding description: 'imported binding'.
> +
> +       env unbind: #Griffle.
> +       two := env bindingOf: #Griffle.
> +       self assert: value equals: foreignBinding value description: 'imported value unaffacted'.
> +       self assert: two == foreignBinding description: 'imported binding still in place'.!
>
>