[squeak-dev] The Inbox: Tests-cwp.281.mcz

Frank Shearar frank.shearar at gmail.com
Wed Jan 1 22:46:03 UTC 2014


On 1 January 2014 22:26, Colin Putney <colin at wiresong.com> wrote:
>
>
>
> On Wed, Jan 1, 2014 at 4:31 PM, Frank Shearar <frank.shearar at gmail.com>
> wrote:
>
>>
>> > Item was added:
>> > + ----- Method: BindingPolicyTest>>testAddHonorsEnvironment (in category
>> > 'tests') -----
>> > + testAddHonorsEnvironment
>> > +       | binding other |
>> > +       other := Environment withName: #other.
>> > +       policy := self bindingPolicyWithNamePolicy: AllNamePolicy new.
>> > +       binding := #Griffle => value.
>> > +       policy binding: binding addedTo: other notify: self.
>> > +       self assert: notified = nil!
>>
>> I think I've established my reputation as a loud lover of
>> #assert:equals: :) Just sayin'.
>
>
> I'm too used to the debugger, I guess. Using #assert:equals: feels like
> JUnit's work around for the fact that you get an error message, not a
> debugger when the test fails. But now that we have automated testing, we
> need the work around too!

Yep :)

>> > Item was changed:
>> >   ----- Method:
>> > EnvironmentTest>>testImportAddingPrefixResolvesUndeclared (in category
>> > 'import tests') -----
>> >   testImportAddingPrefixResolvesUndeclared
>> >         | binding foreign |
>> >         foreign := Environment withName: #Foreign.
>> >         foreign exportSelf.
>> > +       foreign bind: #Griffle to: value.
>> > +       binding := env undeclare: #XXGriffle.
>>
>> I like this. Nice & explicit language.
>
>
> I'm hoping to build up a simple protocol for this stuff, so we can't replace
> all the dictionary manipulation that's scattered around the image with more
> semantically explicit messages. See, for example #declarationOf:.

Yes, indeed.

>> > +       env from: foreign import: {#Nurp -> #Plonk. #Ziffy -> #Wiffy}.
>> > -       env from: foreign import: {#Plonk -> #Nurp. #Wiffy -> #Ziffy}.
>>
>> I find this hard to understand. So the Array of Associations looks
>> like it says "when you see Ziffy, interpret that as if you saw Wiffy",
>> or "map Ziffy to Wiffy". Oh. It says "when you import foreign, map
>> foreign's Ziffy to env's (new) Wiffy. OK, that makes sense.
>
>
> I think I had it backwards in the previous version, because the lazy lookups
> make all the name transformations happen the wrong way around. It should
> match the simple version of the import. So this:
>
> env from: foreign import: #Wiffy
>
> means pretty much what it says, "import #Wiffy from foreign". The renaming
> version is (now) similar:
>
> env from: foreign import: #Wiffy -> #Ziffy
>
> meaning, "import foreign's #Wiffy, but rename it to #Ziffy"
>
> I guess that's the opposite of what you concluded.

Yes, it is. OK. It might just be something to get used to. I wouldn't
mind a comment in #from:import: saying this.

>> >   ----- Method: EnvironmentTest>>testImportWritable (in category 'import
>> > tests') -----
>> >   testImportWritable
>> >         | foreign binding |
>> >         foreign := Environment withName: #Foreign.
>> >         foreign exportSelf.
>> > +       foreign bind: #Griffle to: 'v1'.
>> > +       env from: foreign import: #Griffle -> #Plonk.
>> > -       foreign at: #Griffle put: 'v1'.
>> > -       env from: foreign import: #Plonk -> #Griffle.
>> >         binding := env bindingOf: #Plonk.
>> >         binding value: 'v2'.
>> > +       self assert: (foreign declarationOf: #Griffle) value = 'v2' !
>> > -       self assert: (foreign bindingOf: #Griffle) value == 'v2' !
>>
>
>>
>> I realise this is existing behaviour, but I'm not so keen on
>> sub-environments being able to tinker with parent environments'
>> bindings. What's the use case here? It means an Environment can't be
>> used as a sandbox.
>
>
> This is really for Globals. It just ensures that all environments that share
> a global will see the same value, regardless of what it's called.

Hm, OK.

>> So all this noise in the Monticello tests is because there are two
>> Tests-fbs.280 - one in trunk, and one in the inbox. Fun times. The one
>> in the inbox changes the MC tests to load definitions into an
>> Environment that's then thrown away after the test runs. This avoids
>> MC mucking around with global state.
>
>
> Ugh, sorry about that. Didn't notice the extra changes.

No, that's the thing: because you submitted this commit to the Inbox,
we get a diff against Tests-fbs.280 from the Inbox. These changes
aren't relative to trunk. It's just unfortunate happenstance that I
hacked on Tests in both trunk and Inbox.

The changes aren't in this commit.

>> The changes have been sitting in the Inbox for a week, but given
>> Colin's big chunk of stuff landing in the Inbox, let's review it, push
>> to trunk when ready, and then I'll update my MC test hacking, and
>> resubmit.
>
>
> I've been meaning to review that, but I wanted to get these changes done
> before I forget how they work. :-)

Yeah, I'll rein in my impatience for the moment :)

frank

> Colin


More information about the Squeak-dev mailing list