initial checkin
authorClaus Gittinger <cg@exept.de>
Wed, 22 Nov 2006 14:01:02 +0100
changeset 5 4f5ec216d770
parent 4 3638e3e1e224
child 6 315f77dc132d
initial checkin
test/MCChangeNotificationTest.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/MCChangeNotificationTest.st	Wed Nov 22 14:01:02 2006 +0100
@@ -0,0 +1,71 @@
+"{ Package: 'stx:goodies/monticello/test' }"
+
+MCTestCase subclass:#MCChangeNotificationTest
+	instanceVariableNames:'workingCopy'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Monticello-Tests'
+!
+
+
+!MCChangeNotificationTest methodsFor:'events'!
+
+modifiedEventFor: aSelector ofClass: aClass
+	| method |
+	method := aClass compiledMethodAt: aSelector.
+	^ ModifiedEvent 
+				methodChangedFrom: method
+				to: method
+				selector: aSelector
+				inClass: aClass.
+! !
+
+!MCChangeNotificationTest methodsFor:'private'!
+
+foreignMethod
+	"see testForeignMethodModified"
+! !
+
+!MCChangeNotificationTest methodsFor:'running'!
+
+setUp
+	workingCopy _ MCWorkingCopy forPackage: self mockPackage.
+	
+!
+
+tearDown
+	workingCopy unregister
+! !
+
+!MCChangeNotificationTest methodsFor:'tests'!
+
+testCoreMethodModified
+	| event |
+	workingCopy modified: false.
+	event := self modifiedEventFor: #one ofClass: self mockClassA.
+	MCWorkingCopy methodModified: event.
+	self assert: workingCopy modified
+!
+
+testExtMethodModified
+	| event mref |
+	workingCopy modified: false.
+	mref := workingCopy packageInfo extensionMethods first.
+	event := self modifiedEventFor: mref methodSymbol ofClass: mref actualClass.
+	MCWorkingCopy methodModified: event.
+	self assert: workingCopy modified
+!
+
+testForeignMethodModified
+	| event |
+	workingCopy modified: false.
+	event := self modifiedEventFor: #foreignMethod ofClass: self class.
+	MCWorkingCopy methodModified: event.
+	self deny: workingCopy modified
+! !
+
+!MCChangeNotificationTest class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/test/MCChangeNotificationTest.st,v 1.1 2006-11-22 13:01:02 cg Exp $'
+! !