initial checkin
authorClaus Gittinger <cg@exept.de>
Sat, 20 Aug 2011 14:32:22 +0200
changeset 384 b36b6e679621
parent 383 6505fa7ec585
child 385 1a987f59ffa2
initial checkin
MCFileInTest.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCFileInTest.st	Sat Aug 20 14:32:22 2011 +0200
@@ -0,0 +1,81 @@
+"{ Package: 'stx:goodies/monticello' }"
+
+MCTestCase subclass:#MCFileInTest
+	instanceVariableNames:'stream expected diff'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Monticello-Tests'
+!
+
+
+!MCFileInTest methodsFor:'asserting'!
+
+assertNoChange
+	| actual |
+	actual := MCSnapshotResource takeSnapshot.
+	diff := actual patchRelativeToBase: expected.
+	self assert: diff isEmpty
+! !
+
+!MCFileInTest methodsFor:'running'!
+
+setUp
+        expected := self mockSnapshot.
+        stream := RWBinaryOrTextStream on: String new.
+
+    "Modified: / 12-09-2010 / 15:29:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tearDown
+	(diff isNil or: [diff isEmpty not])
+		 ifTrue: [expected updatePackage: self mockPackage]
+! !
+
+!MCFileInTest methodsFor:'testing'!
+
+alterInitialState
+	self mockClassA touchCVar
+!
+
+assertFileOutFrom: writerClass canBeFiledInWith: aBlock
+	(writerClass on: stream) writeSnapshot: self mockSnapshot.
+	self alterInitialState.
+	self assertSuccessfulLoadWith: aBlock.
+	self mockPackage unload.
+	self assertSuccessfulLoadWith: aBlock.
+
+!
+
+assertInitializersCalled
+	| cvar |
+	cvar := self mockClassA cVar.
+	self assert: cvar = #initialized
+!
+
+assertSuccessfulLoadWith: aBlock
+	stream reset.
+	aBlock value.
+	self assertNoChange.
+	self assertInitializersCalled.
+!
+
+testStWriter
+	self
+		assertFileOutFrom: MCStWriter
+		canBeFiledInWith: [stream fileIn].
+
+! !
+
+!MCFileInTest class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCFileInTest.st,v 1.1 2011-08-20 12:32:22 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCFileInTest.st,v 1.1 2011-08-20 12:32:22 cg Exp $'
+!
+
+version_SVN
+    ^ '§Id: MCFileInTest.st 8 2010-09-12 17:15:52Z vranyj1 §'
+! !