[squeak-dev] The Inbox: Tests-jr.362.mcz

Jakob Reschke jakob.reschke at student.hpi.de
Sun Jan 22 01:22:25 UTC 2017


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 commits at source.squeak.org <commits at source.squeak.org>:
> 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'.!
>
>


More information about the Squeak-dev mailing list