Andreas Raab uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ar.136.mcz ==================== Summary ==================== Name: KernelTests-ar.136 Author: ar Time: 13 February 2010, 3:15:57.866 pm UUID: 983ff31a-55a5-1e4d-a5e3-e060e6bfb7be Ancestors: KernelTests-nice.135 Refactor ClassBuilderTest, removing separate ClassBuilderChangeClassTypeType and ClassBuilderFormatTest (now all part of ClassBuilderTest) =============== Diff against KernelTests-nice.135 =============== Item was added: + ----- Method: ClassBuilderTest>>testDuplicateClassVariableError (in category 'testing - reshape') ----- + testDuplicateClassVariableError + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: 'TestVar' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + + self should:[ + subClass := baseClass subclass: self subClassName + instanceVariableNames: '' + classVariableNames: 'TestVar' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder' + ] raise: DuplicateVariableError. + + [subClass := baseClass subclass: self subClassName + instanceVariableNames: '' + classVariableNames: 'TestVar' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder' + ] on: DuplicateVariableError do:[:ex| + self assert: ex superclass == baseClass. + self assert: ex variable = 'TestVar'. + ex resume. + ]. + + self shouldnt:[ + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] raise: Error. + + self should:[ + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: 'TestVar' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] raise: DuplicateVariableError. + + [baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: 'TestVar' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] on: DuplicateVariableError do:[:ex| + self assert: ex superclass == baseClass. + self assert: ex variable = 'TestVar'. + ex resume. + ].! Item was added: + ----- Method: ClassBuilderTest>>subClassName (in category 'utilities') ----- + subClassName + ^#DummyClassBuilderFormatTestSubClass! Item was added: + ----- Method: ClassBuilderTest>>testWeakSubclass (in category 'testing - format') ----- + testWeakSubclass + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object weakSubclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + "pointer classes" + self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self assert: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self assert: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self assert: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "bit classes" + self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. + self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. + ] ensure:[self cleanup].! Item was added: + ----- Method: ClassBuilderTest>>testSubclassWithInstanceVariables (in category 'testing - format') ----- + testSubclassWithInstanceVariables + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object subclass: self baseClassName + instanceVariableNames: 'var1 var2' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self deny: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "pointer classes" + self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self deny: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self assert: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "bit classes" + self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. + self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. + ] ensure:[self cleanup].! Item was added: + ----- Method: ClassBuilderTest>>tearDown (in category 'running') ----- + tearDown + self cleanup.! Item was added: + ----- Method: ClassBuilderTest>>makeWordVariableSubclassOf: (in category 'utilities') ----- + makeWordVariableSubclassOf: aClass + subClass := aClass variableWordSubclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'! Item was added: + ----- Method: ClassBuilderTest>>makeWeakSubclassOf: (in category 'utilities') ----- + makeWeakSubclassOf: aClass + subClass := aClass weakSubclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'! Item was added: + ----- Method: ClassBuilderTest>>makeVariableSubclassOf: (in category 'utilities') ----- + makeVariableSubclassOf: aClass + subClass := aClass variableSubclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'.! Item was added: + ----- Method: ClassBuilderTest>>makeNormalSubclassOf: (in category 'utilities') ----- + makeNormalSubclassOf: aClass + subClass := aClass subclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'! Item was added: + ----- Method: ClassBuilderTest>>testDuplicateInstanceVariableError (in category 'testing - reshape') ----- + testDuplicateInstanceVariableError + baseClass := Object subclass: self baseClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + + self should:[ + subClass := baseClass subclass: self subClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder' + ] raise: DuplicateVariableError. + + [subClass := baseClass subclass: self subClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder' + ] on: DuplicateVariableError do:[:ex| + self assert: ex superclass == baseClass. + self assert: ex variable = 'var'. + ex resume. + ]. + + self shouldnt:[ + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] raise: Error. + + self should:[ + baseClass := Object subclass: self baseClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] raise: DuplicateVariableError. + + [baseClass := Object subclass: self baseClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] on: DuplicateVariableError do:[:ex| + self assert: ex superclass == baseClass. + self assert: ex variable = 'var'. + ex resume. + ].! Item was added: + ----- Method: ClassBuilderTest>>testChangeToVariableSubclass (in category 'testing - format') ----- + testChangeToVariableSubclass + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + self shouldnt:[baseClass := Object variableSubclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'] raise: Error. + + ] ensure:[self cleanup].! Item was added: + ----- Method: ClassBuilderTest>>testWordVariableSubclass (in category 'testing - format') ----- + testWordVariableSubclass + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object variableWordSubclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. + self deny: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "pointer classes" + self should:[self makeIVarsSubclassOf: baseClass] raise: Error. + self should:[self makeVariableSubclassOf: baseClass] raise: Error. + self should:[self makeWeakSubclassOf: baseClass] raise: Error. + + "bit classes" + self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. + self shouldnt:[self makeWordVariableSubclassOf: baseClass] raise: Error. + self deny: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + ] ensure:[self cleanup].! Item was added: + ClassTestCase subclass: #ClassBuilderTest + instanceVariableNames: 'baseClass subClass' + classVariableNames: '' + poolDictionaries: '' + category: 'KernelTests-Classes'! Item was added: + ----- Method: ClassBuilderTest>>testSubclass (in category 'testing - format') ----- + testSubclass + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self deny: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "pointer classes" + self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self deny: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert:(subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert:(subClass isVariable). + self assert:(subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "bit classes" + self shouldnt:[self makeByteVariableSubclassOf: baseClass] raise: Error. + self deny: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self assert: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeWordVariableSubclassOf: baseClass] raise: Error. + self deny: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + ] ensure:[self cleanup].! Item was added: + ----- Method: ClassBuilderTest>>baseClassName (in category 'utilities') ----- + baseClassName + ^#DummyClassBuilderFormatTestSuperClass! Item was added: + ----- Method: ClassBuilderTest>>testByteVariableSubclass (in category 'testing - format') ----- + testByteVariableSubclass + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object variableByteSubclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + + self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. + self deny: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self assert: (subClass isBytes). + subClass removeFromSystem. + + "pointer classes" + self should:[self makeIVarsSubclassOf: baseClass] raise: Error. + self should:[self makeVariableSubclassOf: baseClass] raise: Error. + self should:[self makeWeakSubclassOf: baseClass] raise: Error. + + "bit classes" + self shouldnt:[self makeByteVariableSubclassOf: baseClass] raise: Error. + self deny: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self assert: (subClass isBytes). + subClass removeFromSystem. + + self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. + + ] ensure:[self cleanup].! Item was added: + ----- Method: ClassBuilderTest>>makeIVarsSubclassOf: (in category 'utilities') ----- + makeIVarsSubclassOf: aClass + subClass := aClass subclass: self subClassName + instanceVariableNames: 'var3 var4' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'! Item was added: + ----- Method: ClassBuilderTest>>testMoveVarFromSuperToSubclass (in category 'testing - reshape') ----- + testMoveVarFromSuperToSubclass + | baseInst subInst | + baseClass := Object subclass: self baseClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + baseClass compile: 'superGet ^var'. + baseClass compile: 'superSet: v var := v'. + + subClass := baseClass subclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + subClass compile: 'subGet ^var'. + subClass compile: 'subSet: v var := v'. + + self assert:[baseClass instSize = 1]. + self assert:[subClass instSize = 1]. + + baseInst := baseClass new. + subInst := subClass new. + baseInst instVarAt: 1 put: 42. + subInst instVarAt: 1 put: 123. + + self assert: (baseInst instVarAt: 1) = 42. + self assert: (subInst instVarAt: 1) = 123. + self assert: (subInst subGet) = 123. + + [subClass := baseClass subclass: self subClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder' + ] on: DuplicateVariableError do:[:ex| ex resume]. + + self assert:[baseClass instSize = 1]. + self assert:[subClass instSize = 2]. + + self assert: (baseInst instVarAt: 1) = 42. + + "the assumption below is that for duplicate variables the values get duplicated too. + this isn't strictly necessary; what we really need is that the old var doesn't get + nuked but it has some advantages when moving vars up the hierarchy" + self assert: (subInst instVarAt: 1) = 123. + self assert: (subInst instVarAt: 2) = 123. + self assert: (subInst superGet) = 123. + self assert: (subInst subGet) = 123. + + "the assumption below is that the subclass binds to the local scope not + the outer one, which is in line with common name space approaches." + subInst superSet: 666. + subInst subSet: 321. + + self assert: (subInst instVarAt: 1) = 666. + self assert: (subInst instVarAt: 2) = 321. + self assert: (subInst superGet) = 666. + self assert: (subInst subGet) = 321. + + baseClass removeSelector: #superGet. + baseClass removeSelector: #superSet:. + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + + self assert:[baseClass instSize = 0]. + self assert:[subClass instSize = 1]. + + self assert: (subInst instVarAt: 1) = 321. + self assert: (subInst subGet) = 321. + ! Item was added: + ----- Method: ClassBuilderTest>>makeByteVariableSubclassOf: (in category 'utilities') ----- + makeByteVariableSubclassOf: aClass + subClass := aClass variableByteSubclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'! Item was added: + ----- Method: ClassBuilderTest>>cleanup (in category 'utilities') ----- + cleanup + subClass ifNotNil:[subClass removeFromSystem]. + baseClass ifNotNil:[baseClass removeFromSystem].! Item was added: + ----- Method: ClassBuilderTest>>testMoveVarFromSubToSuperclass (in category 'testing - reshape') ----- + testMoveVarFromSubToSuperclass + | baseInst subInst | + + baseClass := Object subclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + + subClass := baseClass subclass: self subClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + subClass compile: 'subGet ^var'. + subClass compile: 'subSet: v var := v'. + + self assert:[baseClass instSize = 0]. + self assert:[subClass instSize = 1]. + + baseInst := baseClass new. + subInst := subClass new. + subInst instVarAt: 1 put: 123. + + self assert: (subInst instVarAt: 1) = 123. + self assert: (subInst subGet) = 123. + + [baseClass := Object subclass: self baseClassName + instanceVariableNames: 'var' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + ] on: DuplicateVariableError do:[:ex| ex resume]. + baseClass compile: 'superGet ^var'. + baseClass compile: 'superSet: v var := v'. + + self assert:[baseClass instSize = 1]. + self assert:[subClass instSize = 2]. + + "the assumption here is that an existing value is propagated up" + self assert: (baseInst instVarAt: 1) = nil. + self assert: (subInst instVarAt: 1) = 123. + self assert: (subInst instVarAt: 2) = 123. + + "the assumption below is that the subclass binds to the local scope not + the outer one, which is in line with common name space approaches." + subInst superSet: 666. + subInst subSet: 321. + + self assert: (subInst instVarAt: 1) = 666. + self assert: (subInst instVarAt: 2) = 321. + self assert: (subInst superGet) = 666. + self assert: (subInst subGet) = 321. + + subClass := baseClass subclass: self subClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + + self assert:[baseClass instSize = 1]. + self assert:[subClass instSize = 1]. + + "the assumption here is that the current (subclass) value is propagated up" + self assert: (subInst instVarAt: 1) = 321. + self assert: (subInst subGet) = 321. + ! Item was added: + ----- Method: ClassBuilderTest>>testVariableSubclass (in category 'testing - format') ----- + testVariableSubclass + "Ensure that the invariants for superclass/subclass format are preserved" + baseClass := Object variableSubclass: self baseClassName + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Tests-ClassBuilder'. + [ + "pointer classes" + self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self deny: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. + self assert: (subClass isPointers). + self assert: (subClass isVariable). + self assert: (subClass isWeak). + self deny: (subClass isBytes). + subClass removeFromSystem. + + "bit classes" + self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. + self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. + ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderFormatTests>>testChangeToVariableSubclass (in category 'testing') ----- - testChangeToVariableSubclass - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object subclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - self shouldnt:[baseClass := Object variableSubclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'] raise: Error. - - ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderFormatTests>>testWordVariableSubclass (in category 'testing') ----- - testWordVariableSubclass - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object variableWordSubclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. - self deny: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "pointer classes" - self should:[self makeIVarsSubclassOf: baseClass] raise: Error. - self should:[self makeVariableSubclassOf: baseClass] raise: Error. - self should:[self makeWeakSubclassOf: baseClass] raise: Error. - - "bit classes" - self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. - self shouldnt:[self makeWordVariableSubclassOf: baseClass] raise: Error. - self deny: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderChangeClassTypeTest>>baseClassName (in category 'utilities') ----- - baseClassName - - ^'TestClassForClassChangeTest'! Item was removed: - ----- Method: ClassBuilderFormatTests>>testSubclass (in category 'testing') ----- - testSubclass - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object subclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self deny: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "pointer classes" - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self deny: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert:(subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert:(subClass isVariable). - self assert:(subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "bit classes" - self shouldnt:[self makeByteVariableSubclassOf: baseClass] raise: Error. - self deny: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self assert: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeWordVariableSubclassOf: baseClass] raise: Error. - self deny: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderFormatTests>>baseClassName (in category 'utilities') ----- - baseClassName - ^#DummyClassBuilderFormatTestSuperClass! Item was removed: - ----- Method: ClassBuilderFormatTests>>testByteVariableSubclass (in category 'testing') ----- - testByteVariableSubclass - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object variableByteSubclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. - self deny: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self assert: (subClass isBytes). - subClass removeFromSystem. - - "pointer classes" - self should:[self makeIVarsSubclassOf: baseClass] raise: Error. - self should:[self makeVariableSubclassOf: baseClass] raise: Error. - self should:[self makeWeakSubclassOf: baseClass] raise: Error. - - "bit classes" - self shouldnt:[self makeByteVariableSubclassOf: baseClass] raise: Error. - self deny: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self assert: (subClass isBytes). - subClass removeFromSystem. - - self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. - - ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderFormatTests>>makeIVarsSubclassOf: (in category 'utilities') ----- - makeIVarsSubclassOf: aClass - subClass := aClass subclass: self subClassName - instanceVariableNames: 'var3 var4' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'! Item was removed: - ----- Method: ClassBuilderChangeClassTypeTest>>cleanup (in category 'utilities') ----- - cleanup - baseClass ifNotNil:[baseClass removeFromSystem].! Item was removed: - ----- Method: ClassBuilderFormatTests>>makeByteVariableSubclassOf: (in category 'utilities') ----- - makeByteVariableSubclassOf: aClass - subClass := aClass variableByteSubclass: self subClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'! Item was removed: - TestCase subclass: #ClassBuilderChangeClassTypeTest - instanceVariableNames: 'baseClass subClass' - classVariableNames: '' - poolDictionaries: '' - category: 'KernelTests-Classes'! Item was removed: - ----- Method: ClassBuilderFormatTests>>cleanup (in category 'utilities') ----- - cleanup - subClass ifNotNil:[subClass removeFromSystem]. - baseClass ifNotNil:[baseClass removeFromSystem].! Item was removed: - ----- Method: ClassBuilderFormatTests>>testVariableSubclass (in category 'testing') ----- - testVariableSubclass - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object variableSubclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - "pointer classes" - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self assert: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "bit classes" - self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. - self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. - ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderFormatTests>>testWeakSubclass (in category 'testing') ----- - testWeakSubclass - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object weakSubclass: self baseClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - "pointer classes" - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self assert: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self assert: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self assert: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "bit classes" - self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. - self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. - ] ensure:[self cleanup].! Item was removed: - ----- Method: ClassBuilderFormatTests>>subClassName (in category 'utilities') ----- - subClassName - ^#DummyClassBuilderFormatTestSubClass! Item was removed: - ----- Method: ClassBuilderFormatTests>>testSubclassWithInstanceVariables (in category 'testing') ----- - testSubclassWithInstanceVariables - "Ensure that the invariants for superclass/subclass format are preserved" - baseClass := Object subclass: self baseClassName - instanceVariableNames: 'var1 var2' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'. - [ - self shouldnt:[self makeNormalSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self deny: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "pointer classes" - self shouldnt:[self makeIVarsSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self deny: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeVariableSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self deny: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - self shouldnt:[self makeWeakSubclassOf: baseClass] raise: Error. - self assert: (subClass isPointers). - self assert: (subClass isVariable). - self assert: (subClass isWeak). - self deny: (subClass isBytes). - subClass removeFromSystem. - - "bit classes" - self should:[self makeByteVariableSubclassOf: baseClass] raise: Error. - self should:[self makeWordVariableSubclassOf: baseClass] raise: Error. - ] ensure:[self cleanup].! Item was removed: - TestCase subclass: #ClassBuilderFormatTests - instanceVariableNames: 'baseClass subClass' - classVariableNames: '' - poolDictionaries: '' - category: 'KernelTests-Classes'! Item was removed: - ----- Method: ClassBuilderFormatTests>>makeWordVariableSubclassOf: (in category 'utilities') ----- - makeWordVariableSubclassOf: aClass - subClass := aClass variableWordSubclass: self subClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'! Item was removed: - ----- Method: ClassBuilderFormatTests>>makeWeakSubclassOf: (in category 'utilities') ----- - makeWeakSubclassOf: aClass - subClass := aClass weakSubclass: self subClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'! Item was removed: - ----- Method: ClassBuilderFormatTests>>makeVariableSubclassOf: (in category 'utilities') ----- - makeVariableSubclassOf: aClass - subClass := aClass variableSubclass: self subClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'.! Item was removed: - ----- Method: ClassBuilderFormatTests>>makeNormalSubclassOf: (in category 'utilities') ----- - makeNormalSubclassOf: aClass - subClass := aClass subclass: self subClassName - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Kernel-Tests-ClassBuilder'! |
Free forum by Nabble | Edit this page |