WAStateRegistryTest


Seaside-StateRegistry

Comment:



Hierarchy:

ProtoObject
Object
TestCase
WAStateRegistryTest

Summary:

instance variables:

registry

methods:

instance class
as yet unclassified no messages

Detail:

instance variables:

registry
inferredType:
UndefinedObject

instance methods:

as yet unclassified
assertSnapshot: x isIdenticalTo: y
	
setUp

	registry _ WAStateRegistry new
snapshot: x isIdenticalTo: y

	^ ((IdentitySet withAll: x values) includesAllOf: y values).
testConsecutiveSnapshots

	|a snap1 snap2 snap3 |
	a _ ValueHolder new contents: 1.
	registry registerObject: a.
	snap1 _ registry snapshot.
	snap2 _ registry snapshot.
	self assert: (self snapshot: snap1 isIdenticalTo: snap2).
	a contents: 2.
	snap3 _ registry snapshot.
	self deny: (self snapshot: snap3 isIdenticalTo: snap2).
	
testGarbageCollection

	|a snap1|
	a _ ValueHolder new contents: 1.
	registry registerObject: a.
	snap1 _ registry snapshot.
	Smalltalk garbageCollect.
	self assert: registry size = 1.
	a _ nil.
	Smalltalk garbageCollect.
	self assert: registry size = 0.
testNoChangeAfterRestore

	| a snap1 snap2 snap3 |
	a _ ValueHolder new contents: 1.
	registry registerObject: a.
	snap1 _ registry snapshot.
	a contents: 2.
	snap2 _ registry snapshot.
	self deny: (self snapshot: snap1 isIdenticalTo: snap2).
	registry restoreSnapshot: snap1.
	self assert: a contents = 1.
	snap3 _ registry snapshot.
	self assert: (self snapshot: snap1 isIdenticalTo: snap3).
testRevert

	|a snap1|
	a _ ValueHolder new contents: 1.
	registry registerObject: a.
	snap1 _ registry snapshot.
	a contents: 2.
	self assert: a contents = 2.
	registry restoreSnapshot: snap1.
	self assert: a contents = 1	
testRevertTwice

	|a snap1|
	a _ ValueHolder new contents: 1.
	registry registerObject: a.
	snap1 _ registry snapshot.
	a contents: 2.
	self assert: a contents = 2.
	registry restoreSnapshot: snap1.
	self assert: a contents = 1.
	a contents: 3.
	registry restoreSnapshot: snap1.
	self assert: a contents = 1.

class methods:

^top


- made by Dandelion -