Added package-related tests for MethodChange.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 30 Mar 2014 00:35:25 +0100
changeset 1111 15a933b0f58b
parent 1110 a38d8f5208fd
child 1112 f462798b6a1d
Added package-related tests for MethodChange. When applying a method change, it should honour its package if set. If not, use Class packageQuerySignal to ask for a package.
RegressionTests__ChangeSetTests.st
--- a/RegressionTests__ChangeSetTests.st	Thu Mar 27 17:33:11 2014 +0100
+++ b/RegressionTests__ChangeSetTests.st	Sun Mar 30 00:35:25 2014 +0100
@@ -2112,6 +2112,137 @@
     "Modified: / 06-03-2014 / 17:25:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test_MethodDefinitionChange_06
+
+    | cs |
+
+    cs := ChangeSet fromStream:'
+"{ Package: ''mocks:ChangeSetTests'' }"
+
+Object subclass:#MockClass
+        instanceVariableNames:''''
+        classVariableNames:''''
+        poolDictionaries:''''
+        category:''tests-Regression-Mocks''
+!!
+
+!!MockClass methodsFor:''methods''!!
+
+foo
+
+!! !!
+
+' readStream.
+
+    self assert: cs size == 2.
+    self assert: cs second className = 'MockClass'.
+    self assert: cs second fullClassName = 'MockClass'.
+    self assert: cs second package = 'mocks:ChangeSetTests'.
+    self assert: (Smalltalk at: #MockClass) isNil.
+    cs apply.
+    self assert: (Smalltalk at: #MockClass) notNil.
+    self assert: (Smalltalk at: #MockClass) package = 'mocks:ChangeSetTests'.
+    self assert:((Smalltalk at: #MockClass) methodDictionary includesKey: #foo).
+    self assert:((Smalltalk at: #MockClass) methodDictionary at: #foo) package = 'mocks:ChangeSetTests'.
+
+    "Created: / 29-03-2014 / 23:23:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_MethodDefinitionChange_06_fileIn
+
+    | changefile |
+
+    changefile :='
+"{ Package: ''mocks:ChangeSetTests'' }"
+
+Object subclass:#MockClass
+        instanceVariableNames:''''
+        classVariableNames:''''
+        poolDictionaries:''''
+        category:''tests-Regression-Mocks''
+!!
+
+!!MockClass methodsFor:''methods''!!
+
+foo
+
+!! !!
+
+' readStream.
+
+    self assert: (Smalltalk at: #MockClass) isNil.
+    changefile readStream fileIn.
+    self assert: (Smalltalk at: #MockClass) notNil.
+    self assert: (Smalltalk at: #MockClass) package = 'mocks:ChangeSetTests'.
+    self assert:((Smalltalk at: #MockClass) methodDictionary includesKey: #foo).
+    self assert:((Smalltalk at: #MockClass) methodDictionary at: #foo) package = 'mocks:ChangeSetTests'.
+
+    "Created: / 29-03-2014 / 23:30:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_MethodDefinitionChange_07
+
+    | cs |
+
+    cs := ChangeSet fromStream:'
+"{ Package: ''mocks:ChangeSetTests'' }"
+
+!!MockClass::PrivateClass methodsFor:''methods''!!
+
+foo
+
+!! !!
+' readStream.
+
+    self assert: cs size == 1.
+    self assert: cs first className = 'MockClass::PrivateClass'.
+    self assert: cs first fullClassName = 'MockClass::PrivateClass'.
+    self assert: cs first package = 'mocks:ChangeSetTests'.
+
+    "Created: / 29-03-2014 / 23:31:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_MethodDefinitionChange_07_fileIn
+
+    | changefile |
+
+    self assert: (Smalltalk at: #'MockClass') isNil.
+    self assert: (Smalltalk at: #'MockClass::PrivateClass') isNil.
+
+
+    Object subclass:#MockClass
+        instanceVariableNames:''
+        classVariableNames:''
+        poolDictionaries:''
+        category:'tests-Regression-System-Changes'.
+
+    Object subclass: #PrivateClass
+        instanceVariableNames: ''
+        classVariableNames: ''
+        poolDictionaries: ''
+        privateIn: (Smalltalk at: #'MockClass').
+
+
+    changefile :='
+"{ Package: ''mocks:ChangeSetTests'' }"
+
+!!
+!!MockClass::PrivateClass methodsFor:''methods''!!
+
+foo
+
+!! !!
+' readStream.
+    changefile readStream fileIn.  
+
+    self assert: (Smalltalk at: #'MockClass') notNil.
+    self assert: (Smalltalk at: #'MockClass::PrivateClass') notNil.
+    self assert: ((Smalltalk at: #'MockClass::PrivateClass') methodDictionary includesKey:#foo).
+    self assert: ((Smalltalk at: #'MockClass::PrivateClass') methodDictionary at: #foo) package = 'mocks:ChangeSetTests'.
+
+    "Created: / 29-03-2014 / 23:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test_MethodDefinitionChange_jextension_01a
     "Tests Java extensios - used by stx:libjava (see stx/libjava/java/extensions/**/*.st"