MCFileInTest.st
author Claus Gittinger <cg@exept.de>
Mon, 14 May 2018 02:21:18 +0200
changeset 1048 582b3a028cbc
parent 384 b36b6e679621
permissions -rw-r--r--
#FEATURE by cg class: MCMethodDefinition changed: #postloadOver:

"{ 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 §'
! !