fixed mess made by test cases in the changes file (st.chg)
authorJakub Nesveda <jakubnesveda@seznam.cz>
Sun, 30 Nov 2014 18:32:13 +0100
changeset 769 1d6340bf585a
parent 768 cb3f828caf71
child 770 affa60887c47
fixed mess made by test cases in the changes file (st.chg)
CustomAddClassChangeTests.st
CustomChangeManager.st
CustomCodeGeneratorOrRefactoringTestCase.st
CustomLocalChangeManager.st
CustomLocalChangeManagerTests.st
CustomRBMetaclassTests.st
abbrev.stc
jn_refactoring_custom.st
patches/patches.rc
refactoring_custom.rc
--- a/CustomAddClassChangeTests.st	Sun Nov 30 16:22:07 2014 +0100
+++ b/CustomAddClassChangeTests.st	Sun Nov 30 18:32:13 2014 +0100
@@ -39,13 +39,13 @@
     | realClass |
     
     realClass := Smalltalk classNamed: className.
-    realClass notNil ifTrue: [ 
+    realClass notNil ifTrue: [
         realClass removeFromSystem
     ].
 
     super tearDown.
 
-    "Modified: / 16-10-2014 / 22:59:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 30-11-2014 / 17:04:30 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomAddClassChangeTests methodsFor:'tests'!
--- a/CustomChangeManager.st	Sun Nov 30 16:22:07 2014 +0100
+++ b/CustomChangeManager.st	Sun Nov 30 18:32:13 2014 +0100
@@ -34,3 +34,10 @@
     "Created: / 31-05-2014 / 13:02:03 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomChangeManager class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/CustomCodeGeneratorOrRefactoringTestCase.st	Sun Nov 30 16:22:07 2014 +0100
+++ b/CustomCodeGeneratorOrRefactoringTestCase.st	Sun Nov 30 18:32:13 2014 +0100
@@ -310,6 +310,18 @@
     "Modified: / 19-10-2014 / 14:56:08 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomCodeGeneratorOrRefactoringTestCase methodsFor:'running'!
+
+runCase
+    "Run the case and do not add any mess into the changes file (st.chg)."
+
+    Class withoutUpdatingChangesDo: [ 
+        super runCase
+    ]
+
+    "Created: / 30-11-2014 / 17:02:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !CustomCodeGeneratorOrRefactoringTestCase class methodsFor:'documentation'!
 
 version_HG
--- a/CustomLocalChangeManager.st	Sun Nov 30 16:22:07 2014 +0100
+++ b/CustomLocalChangeManager.st	Sun Nov 30 18:32:13 2014 +0100
@@ -47,7 +47,7 @@
         executedChanges add: aRefactoringChange execute
     ]
 
-    "Modified (comment): / 30-11-2014 / 15:41:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 30-11-2014 / 18:21:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 undoChanges
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CustomLocalChangeManagerTests.st	Sun Nov 30 18:32:13 2014 +0100
@@ -0,0 +1,79 @@
+"{ Package: 'jn:refactoring_custom' }"
+
+TestCase subclass:#CustomLocalChangeManagerTests
+	instanceVariableNames:'changeManager'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Refactoring-Custom-Tests'
+!
+
+!CustomLocalChangeManagerTests methodsFor:'initialization & release'!
+
+setUp
+    super setUp.
+
+    changeManager := CustomLocalChangeManager new.
+
+    "Modified: / 30-11-2014 / 17:32:31 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+tearDown
+    super tearDown.
+
+    (Smalltalk at: #DummyClass01) notNil ifTrue: [ 
+        Class withoutUpdatingChangesDo: [ 
+            (Smalltalk at: #DummyClass01) removeFromSystem
+        ]
+    ]
+
+    "Created: / 30-11-2014 / 17:40:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomLocalChangeManagerTests methodsFor:'private'!
+
+lastChangeInRefactoryChangeManagerAt: aSelector
+
+    ^ [ 
+        RefactoryChangeManager instance perform: aSelector
+    ] on: Collection emptyCollectionSignal do: [ 
+        nil
+    ]
+
+    "Created: / 30-11-2014 / 18:09:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomLocalChangeManagerTests methodsFor:'tests'!
+
+test_perform_change_with_nothing_external_modified
+    | expectedUndo expectedRedo actualUndo actualRedo expectedChangeContents actualChangeContents |
+
+    expectedUndo := self lastChangeInRefactoryChangeManagerAt: #undoChange.
+    expectedRedo := self lastChangeInRefactoryChangeManagerAt: #redoChange.
+    expectedChangeContents := ObjectMemory nameForChanges asFilename contents.
+
+    self assert: (Smalltalk at: #DummyClass01) isNil.
+
+    changeManager performChange: (AddClassChange definition: 'Object subclass:#DummyClass01
+        instanceVariableNames:''''
+        classVariableNames:''''
+        poolDictionaries:''''
+        category:'''' 
+    ').
+
+    self assert: (Smalltalk at: #DummyClass01) notNil.
+
+    changeManager undoChanges.
+
+    self assert: (Smalltalk at: #DummyClass01) isNil.
+
+    actualUndo := self lastChangeInRefactoryChangeManagerAt: #undoChange.
+    actualRedo := self lastChangeInRefactoryChangeManagerAt: #redoChange.
+    actualChangeContents := ObjectMemory nameForChanges asFilename contents.
+
+    self assert: expectedRedo == actualRedo.
+    self assert: expectedUndo == actualUndo.
+    self assert: expectedChangeContents = actualChangeContents.
+
+    "Modified: / 30-11-2014 / 18:20:20 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
--- a/CustomRBMetaclassTests.st	Sun Nov 30 16:22:07 2014 +0100
+++ b/CustomRBMetaclassTests.st	Sun Nov 30 18:32:13 2014 +0100
@@ -163,45 +163,57 @@
 test_private_class_01
     | expectedClass actualClass |
 
-    expectedClass := self class.
+    "Cannot use self class, because TestRunner eats also private classes
+    and when running in private class the class is different"
+    expectedClass := CustomRBMetaclassTests.
     actualClass := CustomRBMetaclassTests::MockPrivateClass01 owningClass.
 
     self assert: expectedClass = actualClass
 
     "Created: / 29-11-2014 / 13:34:35 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified (format): / 30-11-2014 / 17:18:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_private_class_02
     | expectedClass actualClass |
 
-    expectedClass := self class.
+    "Cannot use self class, because TestRunner eats also private classes
+    and when running in private class the class is different"
+    expectedClass := CustomRBMetaclassTests.
     actualClass := CustomRBMetaclassTests::MockPrivateClass01 class owningClass.
 
     self assert: expectedClass = actualClass
 
     "Created: / 29-11-2014 / 13:35:10 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified (format): / 30-11-2014 / 17:18:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_private_class_03
     | expectedClass actualClass |
 
-    expectedClass := self class.
+    "Cannot use self class, because TestRunner eats also private classes
+    and when running in private class the class is different"
+    expectedClass := CustomRBMetaclassTests.
     actualClass := CustomRBMetaclassTests::MockPrivateClass01 theMetaclass owningClass.
 
     self assert: expectedClass = actualClass
 
     "Created: / 29-11-2014 / 13:35:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified (format): / 30-11-2014 / 17:18:01 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_private_class_04
     | expectedClass actualClass |
 
-    expectedClass := self class.
+    "Cannot use self class, because TestRunner eats also private classes
+    and when running in private class the class is different"
+    expectedClass := CustomRBMetaclassTests.
     actualClass := CustomRBMetaclassTests::MockPrivateClass01 theNonMetaclass owningClass.
 
     self assert: expectedClass = actualClass
 
     "Created: / 29-11-2014 / 13:35:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified (format): / 30-11-2014 / 17:18:25 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_top_owning_class_empty
--- a/abbrev.stc	Sun Nov 30 16:22:07 2014 +0100
+++ b/abbrev.stc	Sun Nov 30 18:32:13 2014 +0100
@@ -11,6 +11,7 @@
 CustomContextTests CustomContextTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomDialog CustomDialog jn:refactoring_custom 'Interface-Refactoring-Custom-UI' 0
 CustomDummyTests CustomDummyTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
+CustomLocalChangeManagerTests CustomLocalChangeManagerTests jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 1
 CustomManager CustomManager jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomMenuBuilder CustomMenuBuilder jn:refactoring_custom 'Interface-Refactoring-Custom-UI' 0
 CustomMock CustomMock jn:refactoring_custom 'Interface-Refactoring-Custom-Tests' 0
--- a/jn_refactoring_custom.st	Sun Nov 30 16:22:07 2014 +0100
+++ b/jn_refactoring_custom.st	Sun Nov 30 18:32:13 2014 +0100
@@ -108,6 +108,7 @@
         (CustomContextTests autoload)
         CustomDialog
         (CustomDummyTests autoload)
+        (CustomLocalChangeManagerTests autoload)
         CustomManager
         CustomMenuBuilder
         CustomMock
--- a/patches/patches.rc	Sun Nov 30 16:22:07 2014 +0100
+++ b/patches/patches.rc	Sun Nov 30 18:32:13 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.4.1420\0"
-      VALUE "ProductDate", "Sun, 30 Nov 2014 15:17:39 GMT\0"
+      VALUE "ProductDate", "Sun, 30 Nov 2014 17:25:23 GMT\0"
     END
 
   END
--- a/refactoring_custom.rc	Sun Nov 30 16:22:07 2014 +0100
+++ b/refactoring_custom.rc	Sun Nov 30 18:32:13 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "ProductName\0"
       VALUE "ProductVersion", "6.2.4.1420\0"
-      VALUE "ProductDate", "Sun, 30 Nov 2014 15:17:35 GMT\0"
+      VALUE "ProductDate", "Sun, 30 Nov 2014 17:25:19 GMT\0"
     END
 
   END