[squeak-dev] The Inbox: Environments-fbs.3.mcz

Frank Shearar frank.shearar at gmail.com
Fri Jul 27 14:48:25 UTC 2012


On 27 July 2012 15:45,  <commits at source.squeak.org> wrote:
> Frank Shearar uploaded a new version of Environments to project The Inbox:
> http://source.squeak.org/inbox/Environments-fbs.3.mcz
>
> ==================== Summary ====================
>
> Name: Environments-fbs.3
> Author: fbs
> Time: 27 July 2012, 3:45:30.98 pm
> UUID: f4f0bbda-663d-407b-8dbd-976eb031d247
> Ancestors: Environments-cwp.2
>
> Using a Workspace, if you misspell a classname you get a walkback because Environment doesn't understand #keysDo:. Implementing it results in the desired spelling correction prompt.
>
> =============== Diff against Environments-cwp.2 ===============
>
> Item was added:
> + ----- Method: Environment>>keysDo: (in category 'enumerating') -----
> + keysDo: aBlock
> +       "Evaluate aBlock for each of the receiver's keys."
> +
> +       contents keysDo: aBlock!

I'm struggling to write a test for this. I thought this would work:

testLookupOfMisspelledClassNamePromptsUser
	| griffle |
	self createClass: #Griffle.
	griffle := env at: #Griffle.
	self should: [griffle compile: 'nowTime ^ TimStamp new'] raise:
UndeclaredVariable.

but it doesn't. First it fails because there's no UndeclaredVariable,
but the second time it runs, even though env at: #TimStamp is
KeyNotFound, inspecting the env and evaluating "TimStamp" yields nil.
That's fine if you're in a WorkSpace, which will automatically create
bindings for you, but not so much here.

Or am I misreading my test failure? Could an inspector autocreate the
binding? Even though the env's undeclared is empty, the root
environment's contains #TimStamp->nil.

frank


More information about the Squeak-dev mailing list