[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[jl8] 50

.
self running: 'Class instance variable names tests'
Stream allInstVarNames = #(collection position readLimit)

self running: 'Class instantiation & remotion tests'
(Object subclass: #MyTest) notNil
MyTest removeFromSystem. ^(Smalltalk includesKey: #MyTest) not
(Object subclass: #MyTest) notNil
(Object subclass: #MyTest instanceVariableNames: 'hello world') notNil
MyTest instVarNames = #(hello world)
MyTest removeFromSystem. ^(Smalltalk includesKey: #MyTest) not
(Object subclass: #MyTest) notNil
MyTest removeFromSystem. ^(Smalltalk includesKey: #MyTest) not

(Object subclass: #MyTest) notNil
MyTest superclass = Object
self running: 'Class reshape tests'
(Object subclass: #MyTest instanceVariableNames: 'hello world') notNil
MyTest instVarNames = #(hello world)

self running: 'Class reshape (pool & classVar) tests'
Smalltalk at: #Pool1 put: (PoolDictionary fromTuples: #( #(Color1 1) #(Color2 2) )). ^Pool1 size = 2
Object subclass: #MyTest instanceVariableNames: 'hello my world' classVariableNames: 'ClassVar1 ClassVar2' poolDictionaries: 'Pool1' category: #tests. ^true
MyTest category = #tests
MyTest instVarNames = #(hello my world)
MyTest classVariableNames = #(ClassVar1 ClassVar2)
MyTest poolDictionaryNames = #(Pool1)

self running: 'Class reshape (clean) tests'
Object subclass: #MyTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: #hello. ^true
MyTest category = #hello
MyTest instVarNames isEmpty
MyTest classVariableNames isEmpty
MyTest poolDictionaryNames isEmpty

self running: 'Point subclass tests'
Point subclass: #Point3D instanceVariableNames: #z category: #test. ^true
Point subclasses notEmpty
Point subclasses includes: Point3D
Point3D superclass = Point
Point3D category = #test
Point3D instVarNames = #( z )
Point3D classVariableNames isEmpty
Point3D poolDictionaryNames isEmpty
Point3D allInstVarNames = #(x y z)
Point3D removeFromSystem. ^(Smalltalk includesKey: #Point3D) not

self running: 'fileIn/Out tests'
Point zero respondsTo: #x
Point subclass: #Point3D instanceVariableNames: #z category: #test. ^Smalltalk includesKey: #Point3D
(((Exporter new fileOutMethod: Point>>#x) replace: #x with: #z) replace: #Point with: #Point3D) fileIn. ^Point3D zero respondsTo: #z
|source| source := Exporter new fileOutMethod: Point3D>>#z. Point3D removeFromSystem. Point subclass: #Point3D instanceVariableNames: #z category: #test. source fileIn. ^(Smalltalk at: #Point3D) zero respondsTo: #z
Point3D removeFromSystem. ^(Smalltalk includesKey: #Point3D) not