Colin Putney uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-cwp.281.mcz ==================== Summary ==================== Name: Tests-cwp.281 Author: cwp Time: 1 January 2014, 1:21:21.324 pm UUID: bd0290d9-b157-4355-8e18-8dd4f4705e23 Ancestors: Tests-fbs.280, Tests-cwp.280 merge =============== Diff against Tests-fbs.280 =============== Item was added: + ----- Method: AliasTest>>testSource (in category 'tests') ----- + testSource + | alias source | + source := #Griffle => value. + alias := source asBinding: #Plonk. + self assert: alias source == source! Item was changed: TestCase subclass: #BindingPolicyTest + instanceVariableNames: 'environment policy value notified notifiedBinding' - instanceVariableNames: 'namespace policy value' classVariableNames: '' poolDictionaries: '' category: 'Tests-Environments'! Item was removed: - ----- Method: BindingPolicyTest class>>isAbstract (in category 'as yet unclassified') ----- - isAbstract - ^ self name = #BindingPolicyTest! Item was added: + ----- Method: BindingPolicyTest>>addBinding: (in category 'emulating') ----- + addBinding: aBinding + notified := #add. + notifiedBinding := aBinding! Item was added: + ----- Method: BindingPolicyTest>>bindingPolicyWithNamePolicy: (in category 'tests') ----- + bindingPolicyWithNamePolicy: aPolicy + ^ BindingPolicy + environment: environment + policy: aPolicy + addSelector: #addBinding: + removeSelector: #removeBinding:! Item was added: + ----- Method: BindingPolicyTest>>removeBinding: (in category 'emulating') ----- + removeBinding: aBinding + notified := #remove. + notifiedBinding := aBinding! Item was changed: ----- Method: BindingPolicyTest>>setUp (in category 'running') ----- setUp + environment := Environment withName: #test. - namespace := IdentityDictionary new. value := Object new! Item was added: + ----- Method: BindingPolicyTest>>tearDown (in category 'running') ----- + tearDown + environment destroy. + environment := nil. + value := nil.! 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! Item was added: + ----- Method: BindingPolicyTest>>testAddHonorsName (in category 'tests') ----- + testAddHonorsName + | binding | + policy := self bindingPolicyWithNamePolicy: (ExplicitNamePolicy spec: #Griffle -> #Nurp). + binding := #Griffle => value. + policy binding: binding addedTo: environment notify: self. + self assert: notified == #add! Item was added: + ----- Method: BindingPolicyTest>>testAddHonorsPolicy (in category 'tests') ----- + testAddHonorsPolicy + | binding | + policy := self bindingPolicyWithNamePolicy: (ExplicitNamePolicy spec: #Nurp). + binding := #Griffle => value. + policy binding: binding addedTo: environment notify: self. + self assert: notified = nil! Item was added: + ----- Method: BindingPolicyTest>>testAdded (in category 'tests') ----- + testAdded + | binding | + policy := self bindingPolicyWithNamePolicy: AllNamePolicy new. + binding := #Griffle => value. + policy binding: binding addedTo: environment notify: self. + self assert: notified = #add.! Item was added: + ----- Method: BindingPolicyTest>>testRemoveHonorsEnvironment (in category 'tests') ----- + testRemoveHonorsEnvironment + | binding other | + other := Environment withName: #other. + policy := self bindingPolicyWithNamePolicy: AllNamePolicy new. + binding := #Griffle => value. + policy binding: binding removedFrom: other notify: self. + self assert: notified = nil! Item was added: + ----- Method: BindingPolicyTest>>testRemoveHonorsName (in category 'tests') ----- + testRemoveHonorsName + | binding | + policy := self bindingPolicyWithNamePolicy: (ExplicitNamePolicy spec: #Griffle -> #Nurp). + binding := #Griffle => value. + policy binding: binding removedFrom: environment notify: self. + self assert: notified = #remove. + self assert: notifiedBinding key = #Nurp. + self assert: notifiedBinding source == binding! Item was added: + ----- Method: BindingPolicyTest>>testRemoveHonorsPolicy (in category 'tests') ----- + testRemoveHonorsPolicy + | binding | + policy := self bindingPolicyWithNamePolicy: (ExplicitNamePolicy spec: #Nurp). + binding := #Griffle => value. + policy binding: binding removedFrom: environment notify: self. + self assert: notified = nil! Item was added: + ----- Method: BindingPolicyTest>>testRemoved (in category 'tests') ----- + testRemoved + | binding | + policy := self bindingPolicyWithNamePolicy: AllNamePolicy new. + binding := #Griffle => value. + policy binding: binding removedFrom: environment notify: self. + self assert: notified = #remove! Item was added: + ----- Method: ClassBindingTest>>testSource (in category 'as yet unclassified') ----- + testSource + | binding | + binding := ClassBinding key: #Griffle value: value. + self assert: binding source == binding! Item was changed: + ----- Method: EnvironmentTest>>assertExports:value: (in category 'asserting') ----- - ----- Method: EnvironmentTest>>assertExports:value: (in category 'export tests') ----- assertExports: aSymbol value: v2 + | other | + other := Environment withName: #other. + other import: env. + self assert: (other bindingOf: aSymbol) value = v2! - self assert: (env public includesKey: aSymbol). - self assert: (env public at: aSymbol) == v2! Item was added: + ----- Method: EnvironmentTest>>denyExports: (in category 'asserting') ----- + denyExports: aSymbol + | other | + other := Environment withName: #other. + other import: env. + self assert: (other bindingOf: aSymbol) isNil! Item was changed: ----- Method: EnvironmentTest>>tearDown (in category 'running') ----- tearDown + env destroy. + env := nil! - env destroy! Item was changed: ----- Method: EnvironmentTest>>testAtPutDeclared (in category 'compatibility tests') ----- testAtPutDeclared | binding | + env importSelf. + env bind: #Griffle to: Object new. - env at: #Griffle put: Object new. binding := env bindingOf: #Griffle. env at: #Griffle put: value. self assert: binding value == value! Item was added: + ----- Method: EnvironmentTest>>testDeclaredBecomeClassBinding (in category 'compatibility tests') ----- + testDeclaredBecomeClassBinding + | binding class | + class := Behavior new. + binding := env + bind: #Griffle to: value; + declarationOf: #Griffle. + env at: #Griffle put: class. + self assert: (binding class == ClassBinding). + self assert: binding value == class.! Item was added: + ----- Method: EnvironmentTest>>testDeclaredBecomeGlobal (in category 'compatibility tests') ----- + testDeclaredBecomeGlobal + | binding class | + class := Behavior new. + binding := env + bind: #Griffle to: class; + declarationOf: #Griffle. + env at: #Griffle put: value. + self assert: (binding class == Global). + self assert: binding value == value.! Item was changed: ----- Method: EnvironmentTest>>testExclusiveExplicitExport (in category 'export tests') ----- testExclusiveExplicitExport env export: #Plonk. env at: #Griffle put: Object new. + self denyExports: #Griffle! - self assert: env public isEmpty! Item was changed: ----- Method: EnvironmentTest>>testExclusiveMultiExplicitExport (in category 'export tests') ----- testExclusiveMultiExplicitExport env export: #(Plonk #Griffle). env at: #Nurp put: Object new. + self denyExports: #Nurp! - self assert: env public isEmpty! Item was changed: ----- Method: EnvironmentTest>>testExplicitExport (in category 'export tests') ----- testExplicitExport env export: #Griffle. + env bind: #Griffle to: value. - env at: #Griffle put: value. self assertExports: #Griffle value: value! 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. - foreign at: #Griffle put: value. - env undeclared at: #XXGriffle put: nil. - binding := env undeclared associationAt: #XXGriffle. env import: foreign addingPrefix: 'XX'. self assert: (env bindingOf: #XXGriffle) == binding. self assert: (env valueOf: #XXGriffle) == value! Item was changed: ----- Method: EnvironmentTest>>testImportAlias (in category 'import tests') ----- testImportAlias | foreign binding | foreign := Environment withName: #Foreign. foreign exportSelf. + foreign bind: #Griffle to: value. + env from: foreign import: #Griffle -> #Plonk. - foreign at: #Griffle put: value. - env from: foreign import: #Plonk -> #Griffle. binding := env bindingOf: #Plonk. self assert: binding key = #Plonk. self assert: binding value == value! Item was changed: ----- Method: EnvironmentTest>>testImportAliases (in category 'import tests') ----- testImportAliases | foreign v2 v3 | foreign := Environment withName: #Foreign. foreign exportSelf. foreign at: #Griffle put: value. foreign at: #Nurp put: (v2 := Object new). foreign at: #Ziffy put: (v3 := Object new). + env from: foreign import: {#Nurp -> #Plonk. #Ziffy -> #Wiffy}. - env from: foreign import: {#Plonk -> #Nurp. #Wiffy -> #Ziffy}. self assert: (env bindingOf: #Griffle) isNil. self assert: (env bindingOf: #Plonk) value == v2. self assert: (env bindingOf: #Wiffy) value == v3! Item was changed: ----- Method: EnvironmentTest>>testImportRemovingPrefixResolvesUndeclared (in category 'import tests') ----- testImportRemovingPrefixResolvesUndeclared | binding foreign | foreign := Environment withName: #Foreign. foreign exportSelf. foreign at: #XXGriffle put: value. + binding := env undeclare: #Griffle. - env undeclared at: #Griffle put: nil. - binding := env undeclared associationAt: #Griffle. env import: foreign removingPrefix: 'XX'. self assert: (env bindingOf: #Griffle) == binding. self assert: (env valueOf: #Griffle) == value! Item was changed: ----- Method: EnvironmentTest>>testImportResolvesUndeclared (in category 'import tests') ----- testImportResolvesUndeclared | binding foreign | foreign := Environment withName: #Foreign. foreign exportSelf. foreign at: #Griffle put: value. + binding := env undeclare: #Griffle. - env undeclared at: #Griffle put: nil. - binding := env undeclared associationAt: #Griffle. env import: foreign. self assert: (env bindingOf: #Griffle) == binding. self assert: (env valueOf: #Griffle) == value! Item was changed: ----- 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' ! Item was changed: ----- Method: EnvironmentTest>>testInternalVisibility (in category 'compiling tests') ----- testInternalVisibility | griffle plonk | + env importSelf. 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 changed: ----- Method: EnvironmentTest>>testReadOnlyBindings (in category 'binding tests') ----- testReadOnlyBindings | binding class | class := Behavior new. + env importSelf. + env bind: #Griffle to: class. - env at: #Griffle put: class. binding := env bindingOf: #Griffle. self should: [binding value: nil] raise: AttemptToWriteReadOnlyGlobal! Item was changed: ----- Method: EnvironmentTest>>testRequireExplicitExports (in category 'export tests') ----- testRequireExplicitExports + env bind: #Griffle to: Object new. + self denyExports: #Griffle.! - env at: #Griffle put: Object new. - self assert: env public isEmpty! Item was changed: ----- Method: EnvironmentTest>>testStoreDomesticValue (in category 'compiling tests') ----- testStoreDomesticValue | griffle values | + env importSelf. self createClass: #Griffle. + env bind: #Plonk to: value. - env at: #Plonk put: 'v1'. griffle := env at: #Griffle. griffle compile: self storeValueMethod. values := griffle new doStore. self assert: values isArray. self assert: values size = 2. self assert: values first == values last. + self assert: (env valueOf: #Plonk) == values first! - self assert: (env at: #Plonk) == values first! Item was added: + ----- Method: EnvironmentTest>>testUndeclare (in category 'binding tests') ----- + testUndeclare + | one two | + one := env undeclare: #Griffle. + two := env bindingOf: #Griffle. + self assert: one == two. + self assert: one class == Global! Item was added: + ----- Method: EnvironmentTest>>testUndeclaredBecomeClassBinding (in category 'compatibility tests') ----- + testUndeclaredBecomeClassBinding + | binding class | + class := Behavior new. + binding := env undeclared + add: (#Griffle => nil); + associationAt: #Griffle. + env at: #Griffle put: class. + self assert: (binding class == ClassBinding). + self assert: binding value == class.! Item was added: + ----- Method: EnvironmentTest>>testUndeclaredBecomesGlobal (in category 'compatibility tests') ----- + testUndeclaredBecomesGlobal + | binding class | + class := Behavior new. + binding := env undeclared + add: (#Griffle => class); + associationAt: #Griffle. + env bind: #Griffle to: value. + self assert: (binding class == Global). + self assert: binding value == value.! Item was changed: ----- Method: EnvironmentTest>>testWriteAndLookup (in category 'binding tests') ----- testWriteAndLookup | assoc | + env importSelf. env at: #Griffle put: value. assoc := env bindingOf: #Griffle. self assert: assoc key == #Griffle. self assert: assoc value == value. ! Item was removed: - BindingPolicyTest subclass: #ExportTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Tests-Environments'! Item was removed: - ----- Method: ExportTest>>policyClass (in category 'running') ----- - policyClass - ^ Export! Item was removed: - ----- Method: ExportTest>>testExportAll (in category 'tests') ----- - testExportAll - policy := Export namespace: namespace. - policy bind: #Griffle to: value. - self assert: (namespace at: #Griffle) == value! Item was removed: - ----- Method: ExportTest>>testExported (in category 'tests') ----- - testExported - policy := Export namespace: namespace policy: (ExplicitNamePolicy spec: #(Griffle)). - policy bind: #Griffle to: value. - self assert: (namespace at: #Griffle) == value! Item was removed: - ----- Method: ExportTest>>testNotExported (in category 'tests') ----- - testNotExported - policy := Export namespace: namespace policy: (ExplicitNamePolicy spec: #Nurp). - policy bind: #Griffle to: value. - self assert: namespace isEmpty! Item was removed: - ----- Method: ExportTest>>testStackedExports (in category 'tests') ----- - testStackedExports - | griffle plonk | - griffle := Export - namespace: namespace - policy: (ExplicitNamePolicy spec: #Griffle). - plonk := Export - namespace: namespace - policy: (ExplicitNamePolicy spec: #Plonk) - next: griffle. - plonk bind: #Griffle to: value. - self assert: (namespace at: #Griffle) == value! Item was added: + ----- Method: GlobalTest>>testSource (in category 'tests') ----- + testSource + | global | + global := Global key: #Griffle value: Object new. + self assert: global source == global! Item was removed: - BindingPolicyTest subclass: #ImportTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Tests-Environments'! Item was removed: - ----- Method: ImportTest>>policyClass (in category 'running') ----- - policyClass - ^ Import! Item was removed: - ----- Method: ImportTest>>testImportAll (in category 'tests') ----- - testImportAll - | binding | - policy := Import namespace: namespace. - namespace at: #Griffle put: value. - binding := policy bindingOf: #Griffle. - self assert: binding value == value! Item was removed: - ----- Method: ImportTest>>testImported (in category 'tests') ----- - testImported - | binding | - policy := Import namespace: namespace policy: (ExplicitNamePolicy spec: #Griffle). - namespace at: #Griffle put: value. - binding := policy bindingOf: #Griffle. - self assert: binding value == value.! Item was removed: - ----- Method: ImportTest>>testNotImported (in category 'tests') ----- - testNotImported - | binding | - policy := Import namespace: namespace policy: (ExplicitNamePolicy spec: #Nurp). - namespace at: #Griffle put: value. - binding := policy bindingOf: #Griffle. - self assert: binding value isNil! Item was removed: - ----- Method: ImportTest>>testStackedImports (in category 'tests') ----- - testStackedImports - | griffle plonk binding | - griffle := Import - namespace: namespace - policy: (ExplicitNamePolicy spec: #Griffle). - plonk := Import - namespace: namespace - policy: (ExplicitNamePolicy spec: #Plonk) - next: griffle. - namespace at: #Griffle put: value. - binding := plonk bindingOf: #Griffle. - self assert: binding value == value.! |
Free forum by Nabble | Edit this page |