A new version of Tests was added to project The Inbox:
http://source.squeak.org/inbox/Tests-cwp.150.mcz ==================== Summary ==================== Name: Tests-cwp.150 Author: cwp Time: 20 July 2012, 11:54:47.516 am UUID: f3c34eb2-640c-4252-8da9-e6a1677d8ce0 Ancestors: Tests-bp.149 Introduced EnvironmentTest. =============== Diff against Tests-bp.149 =============== Item was changed: SystemOrganization addCategory: #'Tests-Exceptions'! SystemOrganization addCategory: #'Tests-Files'! SystemOrganization addCategory: #'Tests-Compiler'! SystemOrganization addCategory: #'Tests-Digital Signatures'! SystemOrganization addCategory: #'Tests-Object Events'! SystemOrganization addCategory: #'Tests-System-Support'! SystemOrganization addCategory: #'Tests-Bugs'! SystemOrganization addCategory: #'Tests-ObjectsAsMethods'! SystemOrganization addCategory: #'Tests-PrimCallController'! SystemOrganization addCategory: #'Tests-Release'! SystemOrganization addCategory: #'Tests-Utilities'! SystemOrganization addCategory: #'Tests-VM'! SystemOrganization addCategory: #'Tests-Hex'! SystemOrganization addCategory: #'Tests-Monticello'! SystemOrganization addCategory: #'Tests-Localization'! SystemOrganization addCategory: #'Tests-FilePackage'! SystemOrganization addCategory: #'Tests-Finalization'! SystemOrganization addCategory: #'Tests-Dependencies'! SystemOrganization addCategory: #'Tests-Monticello-Mocks'! + SystemOrganization addCategory: #'Tests-Environments'! Item was added: + TestCase subclass: #EnvironmentTest + instanceVariableNames: 'env value' + classVariableNames: '' + poolDictionaries: '' + category: 'Tests-Environments'! Item was added: + ----- Method: EnvironmentTest>>createClass: (in category 'running') ----- + createClass: aSymbol + | builder | + builder := ClassBuilder new. + builder + name: aSymbol + inEnvironment: env + subclassOf: Object + type: #normal + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Test'. + ! Item was added: + ----- Method: EnvironmentTest>>disabledTestInternalVisibility (in category 'compiling tests') ----- + disabledTestInternalVisibility + | griffle plonk | + self createClass: #Griffle. + self createClass: #Plonk. + griffle := env at: #Griffle. + griffle compile: 'plonk ^ Plonk'. + plonk := griffle new plonk. + self assert: (env at: #Plonk) == plonk! Item was added: + ----- Method: EnvironmentTest>>setUp (in category 'running') ----- + setUp + env := Environment name: 'test'. + value := Object new.! Item was added: + ----- Method: EnvironmentTest>>tearDown (in category 'running') ----- + tearDown + env destroy! Item was added: + ----- Method: EnvironmentTest>>testAtDoesntFindUndeclared (in category 'binding tests') ----- + testAtDoesntFindUndeclared + env := Environment new. + env bindingOf: #Griffle. + self should: [ env at: #Griffle ] raise: KeyNotFound! Item was added: + ----- Method: EnvironmentTest>>testAtIfAbsent (in category 'compatibility tests') ----- + testAtIfAbsent + | result | + result := env at: #Griffle ifAbsent: [value]. + self assert: result == value! Item was added: + ----- Method: EnvironmentTest>>testAtIfAbsentNot (in category 'compatibility tests') ----- + testAtIfAbsentNot + | result | + env at: #Griffle put: value. + result := env at: #Griffle ifAbsent: [self assert: false]. + self assert: result == value! Item was added: + ----- Method: EnvironmentTest>>testAtIfPresent (in category 'compatibility tests') ----- + testAtIfPresent + | result | + env at: #Griffle put: value. + env at: #Griffle ifPresent: [:v | result := v]. + self assert: result == value! Item was added: + ----- Method: EnvironmentTest>>testAtIfPresentNot (in category 'compatibility tests') ----- + testAtIfPresentNot + env at: #Griffle ifPresent: [self assert: false].! Item was added: + ----- Method: EnvironmentTest>>testExplicitExport (in category 'export tests') ----- + testExplicitExport + env requireExplicitExports. + env at: #Griffle put: value. + env export: #Griffle. + self assert: (env exports at: #Griffle) == value! Item was added: + ----- Method: EnvironmentTest>>testImportFromOther (in category 'export tests') ----- + testImportFromOther + | foreign | + foreign := Environment new. + foreign at: #Griffle put: value. + env importEnvironment: foreign. + self assert: (env bindingOf: #Griffle) value == value! Item was added: + ----- Method: EnvironmentTest>>testReadOnlyBindings (in category 'binding tests') ----- + testReadOnlyBindings + | binding class | + class := Behavior new. + env at: #Griffle put: class. + binding := env bindingOf: #Griffle. + self + should: [binding value: nil] + raise: AttemptToWriteReadOnlyGlobal! Item was added: + ----- Method: EnvironmentTest>>testRequireExplicitExportIdempotency (in category 'export tests') ----- + testRequireExplicitExportIdempotency + env requireExplicitExports. + env at: #Griffle put: value. + env export: #Griffle. + env requireExplicitExports. + self assert: (env exports includesKey: #Griffle)! Item was added: + ----- Method: EnvironmentTest>>testRequireExplicitExports (in category 'export tests') ----- + testRequireExplicitExports + env requireExplicitExports. + env at: #Griffle put: Object new. + self assert: env exports isEmpty! Item was added: + ----- Method: EnvironmentTest>>testUndeclaredBindingMoved (in category 'binding tests') ----- + testUndeclaredBindingMoved + | assoc | + assoc := env bindingOf: #Griffle. + env at: #Griffle put: value. + self assert: (env at: #Griffle) == value! Item was added: + ----- Method: EnvironmentTest>>testWriteAndLookup (in category 'binding tests') ----- + testWriteAndLookup + | assoc | + env at: #Griffle put: value. + assoc := env bindingOf: #Griffle. + self assert: assoc key == #Griffle. + self assert: assoc value == value. + ! Item was added: + ----- Method: EnvironmentTest>>testWriteAndRead (in category 'binding tests') ----- + testWriteAndRead + env at: #Griffle put: value. + self assert: (env at: #Griffle) == value.! |
On 20 July 2012 19:54, <[hidden email]> wrote:
> A new version of Tests was added to project The Inbox: > http://source.squeak.org/inbox/Tests-cwp.150.mcz > > ==================== Summary ==================== > > Name: Tests-cwp.150 > Author: cwp > Time: 20 July 2012, 11:54:47.516 am > UUID: f3c34eb2-640c-4252-8da9-e6a1677d8ce0 > Ancestors: Tests-bp.149 > > Introduced EnvironmentTest. > > =============== Diff against Tests-bp.149 =============== > Item was added: > + ----- Method: EnvironmentTest>>testUndeclaredBindingMoved (in category 'binding tests') ----- > + testUndeclaredBindingMoved > + | assoc | > + assoc := env bindingOf: #Griffle. > + env at: #Griffle put: value. > + self assert: (env at: #Griffle) == value! I don't understand this test: it shows you can read to / write from the env, but shouldn't you be doing something with assoc? How are you testing Undeclaredness here? frank |
On Fri, Jul 20, 2012 at 1:18 PM, Frank Shearar <[hidden email]> wrote:
> I don't understand this test: it shows you can read to / write from > the env, but shouldn't you be doing something with assoc? How are you > testing Undeclaredness here? Oh, yeah, that should just be deleted. When I was originally writing Environment, I thought that SystemDictionary handled all the logic around Undeclared - putting the binding in Undeclared when it couldn't be found, moving it to the right place when it was later declared, etc. I wrote some tests to ensure that Environment would handle it correctly. But then I discovered that this logic is actually elsewhere, and forgot to remove the tests. I think this test was going to prove that #bindingOf: answered the same association regardless of whether the variable was declared. Doesn't matter anymore. Colin |
Free forum by Nabble | Edit this page |