[squeak-dev] The Trunk: KernelTests-nice.253.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jul 28 14:15:15 UTC 2013
Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.253.mcz
==================== Summary ====================
Name: KernelTests-nice.253
Author: nice
Time: 28 July 2013, 4:14:45.361 pm
UUID: ea192381-eb68-4388-96a8-36b50701e57c
Ancestors: KernelTests-fbs.252
Add tests for superclass class variable vs global variable scope precedence
See http://bugs.squeak.org/view.php?id=1554
=============== Diff against KernelTests-fbs.252 ===============
Item was added:
+ TestCase subclass: #ClassVarScopeTest
+ instanceVariableNames: 'parent child grandchild foo'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Classes'!
+
+ !ClassVarScopeTest commentStamp: 'nice 7/28/2013 16:05' prior: 0!
+ Test that a class variable defined in a superclass takes precedence over a global variable of same name.
+
+ In #setUp:
+
+ Three classes are defined: parent, child and grandchild.
+ A class variable is defined in child.
+ A global with the same name is defined in Smalltalk globals.
+ Methods are defined in all classes getting and setting this class or global variable.
+
+ Test whether methods referencing the variable with that name
+ access the correct variable.!
Item was added:
+ ----- Method: ClassVarScopeTest>>setUp (in category 'command') -----
+ setUp
+
+ parent := Object
+ subclass: #ClassVarScopeParent
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Dummy-Tests-Class'.
+ child := parent
+ subclass: #ClassVarScopeChild
+ instanceVariableNames: ''
+ classVariableNames: 'ClassVarScopeFoo'
+ poolDictionaries: ''
+ category: 'Dummy-Tests-Class'.
+ grandchild := child
+ subclass: #ClassVarScopeGrandchild
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Dummy-Tests-Class'.
+ foo := Smalltalk globals at: #ClassVarScopeFoo put: Object basicNew.
+
+ parent compile: self sourceOfParentGetFoo.
+ parent compile: self sourceOfParentSetFoo.
+
+ parent class compile: self sourceOfParentGetFoo.
+ parent class compile: self sourceOfParentSetFoo.
+
+ child compile: self sourceOfChildGetFoo.
+ child compile: self sourceOfChildSetFoo.
+
+ child class compile: self sourceOfChildGetFoo.
+ child class compile: self sourceOfChildSetFoo.
+
+ grandchild compile: self sourceOfGrandchildGetFoo.
+ grandchild compile: self sourceOfGrandchildSetFoo.
+
+ grandchild class compile: self sourceOfGrandchildGetFoo.
+ grandchild class compile: self sourceOfGrandchildSetFoo.
+ !
Item was added:
+ ----- Method: ClassVarScopeTest>>sourceOfChildGetFoo (in category 'query') -----
+ sourceOfChildGetFoo
+ ^'childGetFoo
+ ^ClassVarScopeFoo'!
Item was added:
+ ----- Method: ClassVarScopeTest>>sourceOfChildSetFoo (in category 'query') -----
+ sourceOfChildSetFoo
+ ^'childSetFoo: anObject
+ ClassVarScopeFoo := anObject'!
Item was added:
+ ----- Method: ClassVarScopeTest>>sourceOfGrandchildGetFoo (in category 'query') -----
+ sourceOfGrandchildGetFoo
+ ^'grandchildGetFoo
+ ^ClassVarScopeFoo'!
Item was added:
+ ----- Method: ClassVarScopeTest>>sourceOfGrandchildSetFoo (in category 'query') -----
+ sourceOfGrandchildSetFoo
+ ^'grandchildSetFoo: anObject
+ ClassVarScopeFoo := anObject'!
Item was added:
+ ----- Method: ClassVarScopeTest>>sourceOfParentGetFoo (in category 'query') -----
+ sourceOfParentGetFoo
+ ^'parentGetFoo
+ ^ClassVarScopeFoo'!
Item was added:
+ ----- Method: ClassVarScopeTest>>sourceOfParentSetFoo (in category 'query') -----
+ sourceOfParentSetFoo
+ ^'parentSetFoo: anObject
+ ClassVarScopeFoo := anObject'!
Item was added:
+ ----- Method: ClassVarScopeTest>>tearDown (in category 'command') -----
+ tearDown
+ grandchild removeFromChanges; removeFromSystemUnlogged .
+ child removeFromChanges; removeFromSystemUnlogged .
+ parent removeFromChanges; removeFromSystemUnlogged .
+ Smalltalk globals removeKey: #ClassVarScopeFoo!
Item was added:
+ ----- Method: ClassVarScopeTest>>testDefinedClassMethodInChild (in category 'test') -----
+ testDefinedClassMethodInChild
+ self assert: child childGetFoo == nil.
+ child childSetFoo: #bar.
+ self assert: child childGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testDefinedClassMethodInGrandchild (in category 'test') -----
+ testDefinedClassMethodInGrandchild
+ self assert: grandchild grandchildGetFoo == nil.
+ grandchild grandchildSetFoo: #bar.
+ self assert: grandchild grandchildGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testDefinedClassMethodInParent (in category 'test') -----
+ testDefinedClassMethodInParent
+ self assert: parent parentGetFoo == foo.
+ parent parentSetFoo: #bar.
+ self assert: parent parentGetFoo = #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testDefinedInstanceMethodInChild (in category 'test') -----
+ testDefinedInstanceMethodInChild
+ self assert: child basicNew childGetFoo == nil.
+ child basicNew childSetFoo: #bar.
+ self assert: child basicNew childGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testDefinedInstanceMethodInGrandchild (in category 'test') -----
+ testDefinedInstanceMethodInGrandchild
+ self assert: grandchild basicNew grandchildGetFoo == nil.
+ grandchild basicNew grandchildSetFoo: #bar.
+ self assert: grandchild basicNew grandchildGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testDefinedInstanceMethodInParent (in category 'test') -----
+ testDefinedInstanceMethodInParent
+ self assert: parent basicNew parentGetFoo == foo.
+ parent basicNew parentSetFoo: #bar.
+ self assert: parent basicNew parentGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testInheritedClassMethodInChild (in category 'test') -----
+ testInheritedClassMethodInChild
+ self assert: child parentGetFoo == foo.
+ child parentSetFoo: #bar.
+ self assert: child parentGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testInheritedClassMethodInGrandchild (in category 'test') -----
+ testInheritedClassMethodInGrandchild
+ self assert: grandchild childGetFoo == nil.
+ grandchild childSetFoo: #bar.
+ self assert: grandchild childGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testInheritedInstanceMethodInChild (in category 'test') -----
+ testInheritedInstanceMethodInChild
+ self assert: child basicNew parentGetFoo == foo.
+ child basicNew parentSetFoo: #bar.
+ self assert: child basicNew parentGetFoo == #bar!
Item was added:
+ ----- Method: ClassVarScopeTest>>testInheritedInstanceMethodInGrandchild (in category 'test') -----
+ testInheritedInstanceMethodInGrandchild
+ self assert: grandchild basicNew childGetFoo == nil.
+ grandchild basicNew childSetFoo: #bar.
+ self assert: grandchild basicNew childGetFoo == #bar!
More information about the Squeak-dev
mailing list
|