SystemOrganization addCategory: #'OB-Tests-Refactory-Browsers'! SystemOrganization addCategory: #'OB-Tests-Refactory-Refactoring'! OBBrowserTest subclass: #OREnvironmentBrowserTest instanceVariableNames: 'environment' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! OREnvironmentBrowserTest subclass: #ORCategoryBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORCategoryBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:27'! browserClass ^ ORCategoryBrowser! ! !ORCategoryBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:36'! environment ^ BrowserEnvironment new forCategories: (Array with: self class category)! ! !ORCategoryBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:46'! testInitalDisplay self assertListAt: 1 includes: (Array with: self class category)! ! OREnvironmentBrowserTest subclass: #ORClassBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORClassBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:27'! browserClass ^ ORClassBrowser! ! !ORClassBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:44'! environment ^ BrowserEnvironment new forClasses: self class allSuperclasses! ! !ORClassBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:46'! testInitalDisplay self assertListAt: 1 includes: (self class allSuperclasses collect: [ :each | each name ])! ! !OREnvironmentBrowserTest class methodsFor: 'testing' stamp: 'lr 2/7/2010 14:25'! isAbstract ^ self name = #OREnvironmentBrowserTest! ! !OREnvironmentBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:35'! environment self subclassResponsibility! ! !OREnvironmentBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:42'! node ^ OREnvironmentNode onEnvironment: self environment! ! OREnvironmentBrowserTest subclass: #ORMethodBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORMethodBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:27'! browserClass ^ ORMethodBrowser! ! !ORMethodBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:47'! environment ^ BrowserEnvironment new implementorsOf: #environment! ! !ORMethodBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:49'! testInitalDisplay self assertListAt: 1 includes: (Array with: self class name , '>>environment {configuration}')! ! OREnvironmentBrowserTest subclass: #ORMultiBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORMultiBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:27'! browserClass ^ ORMultiBrowser! ! !ORMultiBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:52'! environment ^ MultiEnvironment new addClass: self class into: 'first'; yourself! ! !ORMultiBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:53'! testInitalDisplay self assertListAt: 1 includes: #('first')! ! OREnvironmentBrowserTest subclass: #ORPackageBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORPackageBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:28'! browserClass ^ ORPackageBrowser! ! !ORPackageBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:38'! environment ^ BrowserEnvironment new forPackageNames: #('OB-Tests-Refactory')! ! !ORPackageBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:49'! testInitalDisplay self assertListAt: 1 includes: (Array with: self class category)! ! OREnvironmentBrowserTest subclass: #ORProtocolBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORProtocolBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:28'! browserClass ^ ORProtocolBrowser! ! !ORProtocolBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:38'! environment ^ BrowserEnvironment new forClass: self class protocols: #(configuration)! ! !ORProtocolBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:50'! testInitalDisplay self assertListAt: 1 includes: #(configuration)! ! OREnvironmentBrowserTest subclass: #ORSingleClassBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORSingleClassBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:28'! browserClass ^ ORSingleClassBrowser! ! !ORSingleClassBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:39'! environment ^ BrowserEnvironment new forClasses: (Array with: self class)! ! !ORSingleClassBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:50'! testInitalDisplay self assertListAt: 1 includes: #(configuration)! ! OREnvironmentBrowserTest subclass: #ORSystemBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORSystemBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:28'! browserClass ^ ORSystemBrowser! ! !ORSystemBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:39'! environment ^ BrowserEnvironment new! ! !ORSystemBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:51'! testInitalDisplay self assertListAt: 1 includes: Smalltalk organization categories! ! OREnvironmentBrowserTest subclass: #ORVariableBrowserTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! !ORVariableBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:28'! browserClass ^ ORVariableBrowser! ! !ORVariableBrowserTest methodsFor: 'configuration' stamp: 'lr 2/7/2010 14:40'! environment ^ BrowserEnvironment new instVarRefsTo: 'testSelector' in: self class! ! !ORVariableBrowserTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:51'! testInitalDisplay self assertListAt: 1 includes: #('TestCase testSelector')! ! OBCommandTest subclass: #ORCommandTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Browsers'! ORCommandTest subclass: #ORCmdRefactoringTest instanceVariableNames: 'model node target' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdRefactoringTest subclass: #ORCmdClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdClassRefactoringTest subclass: #ORCmdAccessorClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAccessorClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAccessorClassRefactoring! ! !ORCmdAccessorClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:02'! testRefactoring01 self node: BogusB asNode. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #firstInstanceVariableB: for: #BogusB) = (RBParser parseMethod: 'firstInstanceVariableB: anObject firstInstanceVariableB := anObject'). self assert: (self parseTree: #secondInstanceVariableB for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB ^ secondInstanceVariableB'). self assert: (self parseTree: #secondInstanceVariableB: for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB: anObject secondInstanceVariableB := anObject')! ! !ORCmdAccessorClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:02'! testRefactoring02 self node: BogusB asClassSideNode. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #firstClassInstanceVariableB for: #'BogusB class') = (RBParser parseMethod: 'firstClassInstanceVariableB ^ firstClassInstanceVariableB'). self assert: (self parseTree: #firstClassInstanceVariableB: for: #'BogusB class') = (RBParser parseMethod: 'firstClassInstanceVariableB: anObject firstClassInstanceVariableB := anObject'). self assert: (self parseTree: #secondClassInstanceVariableB for: #'BogusB class') = (RBParser parseMethod: 'secondClassInstanceVariableB ^ secondClassInstanceVariableB'). self assert: (self parseTree: #secondClassInstanceVariableB: for: #'BogusB class') = (RBParser parseMethod: 'secondClassInstanceVariableB: anObject secondClassInstanceVariableB := anObject')! ! !ORCmdClassRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:26'! isAbstract ^ self name = #ORCmdClassRefactoringTest! ! ORCmdClassRefactoringTest subclass: #ORCmdCreateSubclassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdCreateSubclassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdCreateSubclassRefactoring! ! !ORCmdCreateSubclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:03'! testRefactoring01 self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { BogusE } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) superclass = (self classFor: #BogusA). self assert: (self classFor: #BogusX) subclasses size = 1! ! !ORCmdCreateSubclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:04'! testRefactoring02 self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) superclass = (self classFor: #BogusA). self assert: (self classFor: #BogusX) subclasses isEmpty! ! ORCmdClassRefactoringTest subclass: #ORCmdCreateSuperclassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdCreateSuperclassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdCreateSuperclassRefactoring! ! !ORCmdCreateSuperclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:04'! testRefactoring01 self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { BogusE } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) subclasses size = 2. self assert: ((self classFor: #BogusX) subclasses includes: (self classFor: #BogusA)). self assert: ((self classFor: #BogusX) subclasses includes: (self classFor: #BogusE))! ! !ORCmdCreateSuperclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:04'! testRefactoring02 self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) subclasses size = 1. self assert: ((self classFor: #BogusX) subclasses includes: (self classFor: #BogusA)) ! ! ORCmdClassRefactoringTest subclass: #ORCmdRealizeClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRealizeClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRealizeClassRefactoring! ! !ORCmdRealizeClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring (self classFor: #BogusA) compile: 'zork self subclassResponsibility' classified: #(accessing). self node: BogusE asNode. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #zork for: #BogusE) = (RBParser parseMethod: 'zork self shouldBeImplemented')! ! ORCmdClassRefactoringTest subclass: #ORCmdRemoveClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveClassRefactoring! ! !ORCmdRemoveClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: BogusA asNode. self performRefactoringUsing: { OBConfirmationRequest. true. OBBrowseRequest. [ :request | self assert: (request browser isKindOf: ORMethodBrowser). self assert: (request browser root browserEnvironment isEmpty not). ^ self ] } , self browserRequestInteraction. self assert: false ! ! ORCmdClassRefactoringTest subclass: #ORCmdRenameClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameClassRefactoring! ! !ORCmdRenameClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'BogusX' } , self browserRequestInteraction. self assert: self changes size = 1. self assert: (self classFor: #BogusA) isNil. self assert: (self classFor: #BogusX) notNil! ! ORCmdClassRefactoringTest subclass: #ORCmdSplitClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdSplitClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdSplitClassRefactoring! ! !ORCmdSplitClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: BogusB asNode. self performRefactoringUsing: { OBMultipleChoiceRequest. { 'secondInstanceVariableB' }. OBTextRequest. #BogusX. OBTextRequest. 'other' } , self browserRequestInteraction. self assert: ((self classFor: #BogusB) instanceVariableNames includes: 'other'). self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB'). self assert: ((self classFor: #BogusX) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdRefactoringTest subclass: #ORCmdClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdClassVarRefactoringTest subclass: #ORCmdAbstractClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAbstractClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAbstractClassVarRefactoring! ! !ORCmdAbstractClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: ORLintBrowser asClassSideNode. self performRefactoringUsing: { OBChoiceRequest. 'PaneCount' } , self browserRequestInteraction. self assert: (self parseTree: #paneCount1 for: #'ORLintBrowser class') = (RBParser parseMethod: 'paneCount1 ^ PaneCount'). self assert: (self parseTree: #paneCount: for: #'ORLintBrowser class') = (RBParser parseMethod: 'paneCount: anObject PaneCount := anObject'). self assert: ((self classFor: #ORLintBrowser) whichSelectorsReferToClassVariable: 'PaneCount') isEmpty. self assert: ((self classFor: #'ORLintBrowser class') whichSelectorsReferToClassVariable: 'PaneCount') size = 2 ! ! ORCmdClassVarRefactoringTest subclass: #ORCmdAccessorClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAccessorClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAccessorClassVarRefactoring! ! !ORCmdAccessorClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: (OBClassVariableNode on: 'SecondClassVariableB' inClass: BogusB). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #secondClassVariableB for: #'BogusB class') = (RBParser parseMethod: 'secondClassVariableB ^ SecondClassVariableB'). self assert: (self parseTree: #secondClassVariableB: for: #'BogusB class') = (RBParser parseMethod: 'secondClassVariableB: anObject SecondClassVariableB := anObject')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdAddClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAddClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAddClassVarRefactoring! ! !ORCmdAddClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'BogusX' } , self browserRequestInteraction. self assert: ((self classFor: #BogusA) classVariableNames includes: 'BogusX')! ! !ORCmdClassVarRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:26'! isAbstract ^ self name = #ORCmdClassVarRefactoringTest! ! ORCmdClassVarRefactoringTest subclass: #ORCmdPullUpClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPullUpClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPullUpClassVarRefactoring! ! !ORCmdPullUpClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: (OBClassVariableNode on: 'SecondClassVariableB' inClass: BogusB). self performRefactoringUsing: self browserRequestInteraction. self deny: ((self classFor: #BogusB) classVariableNames includes: 'SecondClassVariableB'). self assert: ((self classFor: #Object) classVariableNames includes: 'SecondClassVariableB')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdPushDownClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushDownClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushDownClassVarRefactoring! ! !ORCmdPushDownClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:08'! testRefactoring01 self node: BogusB asNode. self performRefactoringUsing: { OBChoiceRequest. 'FirstClassVariableB'. OBConfirmationRequest. false }! ! !ORCmdPushDownClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:08'! testRefactoring02 "The variable is still referenced." self node: BogusB asNode. self performRefactoringUsing: { OBChoiceRequest. 'SecondClassVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) classVariableNames includes: 'SecondClassVariableB')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdRemoveClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveClassVarRefactoring! ! !ORCmdRemoveClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:09'! testRefactoring01 self node: BogusB asNode. self performRefactoringUsing: { OBChoiceRequest. 'FirstClassVariableB'. OBConfirmationRequest. false }! ! !ORCmdRemoveClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:10'! testRefactoring02 self node: BogusB asNode. self performRefactoringUsing: { OBChoiceRequest. 'SecondClassVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) classVariableNames includes: 'SecondClassVariableB')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdRenameClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameClassVarRefactoring! ! !ORCmdRenameClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: (OBClassVariableNode on: 'FirstClassVariableB' inClass: BogusB). self performRefactoringUsing: { OBTextRequest. 'Zork' } , self browserRequestInteraction. self assert: ((self classFor: #BogusB) classVariableNames includes: 'Zork'). self assert: (self parseTree: #accessesCVar for: #BogusB) = (RBParser parseMethod: 'accessesCVar ^ Zork')! ! ORCmdRefactoringTest subclass: #ORCmdInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdInstVarRefactoringTest subclass: #ORCmdAbstractInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAbstractInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAbstractInstVarRefactoring! ! !ORCmdAbstractInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: ORLintBrowser asNode. self performRefactoringUsing: { OBChoiceRequest. 'process' } , self browserRequestInteraction. self assert: (self parseTree: #process for: #ORLintBrowser) = (RBParser parseMethod: 'process ^ process'). self assert: (self parseTree: #process: for: #ORLintBrowser) = (RBParser parseMethod: 'process: anObject ^ process := anObject'). self assert: ((self classFor: #ORLintBrowser) whichSelectorsReferToInstanceVariable: 'process') size = 2 ! ! ORCmdInstVarRefactoringTest subclass: #ORCmdAccessorInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAccessorInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAccessorInstVarRefactoring! ! !ORCmdAccessorInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: (OBInstanceVariableNode on: 'secondInstanceVariableB' inClass: BogusB). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #secondInstanceVariableB for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB ^ secondInstanceVariableB'). self assert: (self parseTree: #secondInstanceVariableB: for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB: anObject secondInstanceVariableB := anObject')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdAddInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAddInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAddInstVarRefactoring! ! !ORCmdAddInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: BogusA asNode. self performRefactoringUsing: { OBTextRequest. 'zork' } , self browserRequestInteraction. self assert: ((self classFor: #BogusA) instanceVariableNames includes: 'zork')! ! !ORCmdInstVarRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:27'! isAbstract ^ self name = #ORCmdInstVarRefactoringTest! ! ORCmdInstVarRefactoringTest subclass: #ORCmdProtectInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdProtectInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdProtectInstVarRefactoring! ! !ORCmdProtectInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: ORLintBrowser asNode. self performRefactoringUsing: { OBChoiceRequest. 'environment' } , self browserRequestInteraction. self deny: ((RBNamespace new classNamed: #ORLintBrowser) whichSelectorsReferToSymbol: #environment) isEmpty. self assert: ((self classFor: #ORLintBrowser) whichSelectorsReferToSymbol: #environment) isEmpty! ! ORCmdInstVarRefactoringTest subclass: #ORCmdPullUpInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPullUpInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPullUpInstVarRefactoring! ! !ORCmdPullUpInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: (OBInstanceVariableNode on: 'secondInstanceVariableB' inClass: BogusB). self performRefactoringUsing: { OBConfirmationRequest. true } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB'). self assert: ((self classFor: #Object) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdPushDownInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushDownInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushDownInstVarRefactoring! ! !ORCmdPushDownInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:34'! testRefactoring self node: BogusB asNode. self performRefactoringUsing: { OBChoiceRequest. 'secondInstanceVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdRemoveInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveInstVarRefactoring! ! !ORCmdRemoveInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:34'! testRefactoring self node: BogusB asNode. self performRefactoringUsing: { OBChoiceRequest. 'secondInstanceVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdRenameInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameInstVarRefactoring! ! !ORCmdRenameInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:35'! testRefactoring self node: (OBInstanceVariableNode on: 'firstInstanceVariableB' inClass: BogusB). self performRefactoringUsing: { OBTextRequest. 'zork' } , self browserRequestInteraction. self assert: ((self classFor: #BogusB) instanceVariableNames includes: 'zork'). self assert: (self parseTree: 'accessesIvar' asSymbol for: #BogusB) = (RBParser parseMethod: 'accessesIvar ^ zork')! ! ORCmdRefactoringTest subclass: #ORCmdMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdMethodRefactoringTest subclass: #ORCmdAddParameterMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAddParameterMethodRefactoring! ! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:48'! methodThatNeedsParameter ^ true! ! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:48'! methodThatSendsMethod self methodThatNeedsParameter! ! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: (OBMethodNode on: #methodThatNeedsParameter inClass: self class). self performRefactoringUsing: { OBMultiLineTextRequest. 'methodThatNeedsParameter:'. OBMultiLineTextRequest. 'false' } , self browserRequestInteraction. self assert: (self parseTree: #methodThatNeedsParameter: for: self class) = (RBParser parseMethod: 'methodThatNeedsParameter: anObject ^ true'). self assert: (self parseTree: #methodThatSendsMethod for: self class) = (RBParser parseMethod: 'methodThatSendsMethod self methodThatNeedsParameter: false'). self assert: (self parseTree: #methodThatNeedsParameter for: self class) isNil! ! ORCmdMethodRefactoringTest subclass: #ORCmdInlineParameterRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineParameterRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineParameterRefactoring! ! !ORCmdInlineParameterRefactoringTest methodsFor: 'support' stamp: 'lr 1/18/2010 19:14'! messageThatSendsParameter self messageToInlineParameter: 123! ! !ORCmdInlineParameterRefactoringTest methodsFor: 'support' stamp: 'lr 1/18/2010 19:26'! messageToInlineParameter: anInteger ^ anInteger negated! ! !ORCmdInlineParameterRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: (OBMethodNode on: #messageToInlineParameter: inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #messageToInlineParameter: for: self class) isNil. self assert: (self parseTree: #messageToInlineParameter for: self class) = (RBParser parseMethod: 'messageToInlineParameter | anInteger | anInteger := 123. ^ anInteger negated'). self assert: (self parseTree: #messageThatSendsParameter for: self class) = (RBParser parseMethod: 'messageThatSendsParameter self messageToInlineParameter')! ! ORCmdMethodRefactoringTest subclass: #ORCmdInlineSelfSendsMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineSelfSendsMethodRefactoring! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:52'! methodThatSendsToTheReceiver self methodThatWillBeInlined! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:55'! methodThatWillBeInlined ^ 1 + 2! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:54'! otherMethodThatSendsToTheReceiver ^ self methodThatWillBeInlined - 1! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: (OBMethodNode on: #methodThatWillBeInlined inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodThatSendsToTheReceiver for: self class) = (RBParser parseMethod: 'methodThatSendsToTheReceiver 1 + 2'). self assert: (self parseTree: #otherMethodThatSendsToTheReceiver for: self class) = (RBParser parseMethod: 'otherMethodThatSendsToTheReceiver ^ 1 + 2 - 1')! ! !ORCmdMethodRefactoringTest class methodsFor: 'testing' stamp: 'lr 2/7/2010 12:36'! factory self subclassResponsibility! ! !ORCmdMethodRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:27'! isAbstract ^ self name = #ORCmdMethodRefactoringTest! ! ORCmdMethodRefactoringTest subclass: #ORCmdMoveMethodRefactoringTest instanceVariableNames: 'delegate' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdMoveMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdMoveMethodRefactoring! ! !ORCmdMoveMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 11:40'! methodThatWillBeMoved ^ 101! ! !ORCmdMoveMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 6/15/2010 10:57'! testRefactoring self node: (OBMethodNode on: #methodThatWillBeMoved inClass: self class). self performRefactoringUsing: { OBChoiceRequest. 'delegate'. OBMultiLineTextRequest. 'ORCmdAddParameterMethodRefactoringTest'. ORMethodNameRequest. RBMethodName selector: #methodThatWillBeMovedAtNewLocation arguments: #() } , self browserRequestInteraction. self assert: (self parseTree: #methodThatWillBeMoved for: self class) = (RBParser parseMethod: 'methodThatWillBeMoved ^ delegate methodThatWillBeMovedAtNewLocation'). self assert: (self parseTree: #methodThatWillBeMovedAtNewLocation for: ORCmdAddParameterMethodRefactoringTest) = (RBParser parseMethod: 'methodThatWillBeMovedAtNewLocation ^ 101')! ! ORCmdMethodRefactoringTest subclass: #ORCmdPullUpMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPullUpMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 7/17/2010 22:40'! factory ^ ORCmdPullUpMethodRefactoring! ! !ORCmdPullUpMethodRefactoringTest methodsFor: 'support' stamp: 'lr 7/17/2010 22:50'! methodToPullUp! ! !ORCmdPullUpMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 7/17/2010 22:50'! testRefactoring self node: (OBMethodNode on: #methodToPullUp inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodToPullUp for: self class) isNil. self assert: (self parseTree: #methodToPullUp for: self class superclass) = (RBParser parseMethod: 'methodToPullUp')! ! ORCmdMethodRefactoringTest subclass: #ORCmdPushDownMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushDownMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushDownMethodRefactoring! ! !ORCmdPushDownMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 12:39'! methodToPushDown! ! !ORCmdPushDownMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: (OBMethodNode on: #methodToPushDown inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodToPushDown for: self class) isNil. self class subclasses do: [ :class | self assert: (self parseTree: #methodToPushDown for: class) = (RBParser parseMethod: 'methodToPushDown') ]! ! ORCmdMethodRefactoringTest subclass: #ORCmdRemoveMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveMethodRefactoringTest methodsFor: 'support' stamp: 'lr 1/17/2010 15:42'! bogusSelectorThatIsHopefullyNotReferencedAnywhere! ! !ORCmdRemoveMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveMethodRefactoring! ! !ORCmdRemoveMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:10'! testRefactoring01 | selector | selector := ('bogusSelectorThatIs' , 'HopefullyNotReferencedAnywhere') asSymbol. self node: (OBMethodNode on: selector inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: selector for: self class name) isNil! ! !ORCmdRemoveMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:11'! testRefactoring02 self node: (OBMethodNode on: #factory inClass: self class). self performRefactoringUsing: { OBConfirmationRequest. true. OBBrowseRequest. [ :request | self assert: (request browser isKindOf: ORMethodBrowser) ] }! ! ORCmdMethodRefactoringTest subclass: #ORCmdRemoveParameterRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveParameterRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveParameterRefactoring! ! !ORCmdRemoveParameterRefactoringTest methodsFor: 'support' stamp: 'lr 1/17/2010 15:44'! somethingThatSends ^ self somethingWithParameter: 5! ! !ORCmdRemoveParameterRefactoringTest methodsFor: 'support' stamp: 'lr 1/17/2010 15:44'! somethingWithParameter: anObject ^ 2! ! !ORCmdRemoveParameterRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:36'! testRefactoring self node: (OBMethodNode on: #somethingWithParameter: inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #somethingWithParameter: for: self class name) isNil. self assert: (self parseTree: #somethingWithParameter for: self class name) = (RBParser parseMethod: 'somethingWithParameter ^ 2'). self assert: (self parseTree: #somethingThatSends for: self class name) = (RBParser parseMethod: 'somethingThatSends ^ self somethingWithParameter').! ! ORCmdMethodRefactoringTest subclass: #ORCmdRenameMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameMethodRefactoring! ! !ORCmdRenameMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 12:44'! somethingThatSends self somethingToBeRenamed! ! !ORCmdRenameMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 12:44'! somethingToBeRenamed! ! !ORCmdRenameMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 6/15/2010 10:56'! testRefactoring self node: (OBMethodNode on: #somethingToBeRenamed inClass: self class). self performRefactoringUsing: { ORMethodNameRequest. RBMethodName selector: #somethingWithNewName arguments: #() } , self browserRequestInteraction. self assert: (self parseTree: #somethingToBeRenamed for: self class) isNil. self assert: (self parseTree: #somethingWithNewName for: self class) = (RBParser parseMethod: 'somethingWithNewName'). self assert: (self parseTree: #somethingThatSends for: self class) = (RBParser parseMethod: 'somethingThatSends self somethingWithNewName').! ! ORCmdMethodRefactoringTest subclass: #ORCmdSwapMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdSwapMethodRefactoringTest class methodsFor: 'support' stamp: 'lr 1/17/2010 15:49'! classSideMethod ^ #classSide! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdSwapMethodRefactoring! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'support' stamp: 'lr 1/17/2010 15:51'! instanceSideMethod ^ #instanceSide! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'running' stamp: 'lr 2/7/2010 13:14'! setUp super setUp. self node: (OBMethodNode on: #one inClass: BogusA)! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:14'! testLabel self node: (OBMethodNode on: #one inClass: BogusA). self assert: self command label = 'move to class side'. self node: (OBMethodNode on: #one inClass: BogusA class). self assert: self command label = 'move to instance side'! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:12'! testRefactoring01 self node: (OBMethodNode on: #classSideMethod inClass: self class class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #classSideMethod for: self class class name) isNil. self assert: (self parseTree: #classSideMethod for: self class name) = (RBParser parseMethod: 'classSideMethod ^ #classSide')! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:12'! testRefactoring02 self node: (OBMethodNode on: #instanceSideMethod inClass: self class). self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #instanceSideMethod for: self class class name) = (RBParser parseMethod: 'instanceSideMethod ^ #instanceSide'). self assert: (self parseTree: #instanceSideMethod for: self class name) isNil ! ! !ORCmdRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:26'! isAbstract ^ self name = #ORCmdRefactoringTest! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 1/17/2010 10:33'! browser ^ self! ! !ORCmdRefactoringTest methodsFor: 'utilities' stamp: 'lr 2/6/2010 16:12'! browserRequestInteraction ^ Array with: OBBrowseRequest with: [ :request | self assert: (request browser isKindOf: ORChangesBrowser). self assert: (request browser root change = self change) ]! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/21/2010 15:37'! change ^ self model changes! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/21/2010 15:37'! changes ^ self change changes! ! !ORCmdRefactoringTest methodsFor: 'accessing-model' stamp: 'lr 1/18/2010 19:23'! classFor: aSymbolOrBehavior ^ self model classNamed: (aSymbolOrBehavior isBehavior ifFalse: [ aSymbolOrBehavior asSymbol ] ifTrue: [ aSymbolOrBehavior name ])! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 2/7/2010 13:06'! command ^ self factory on: target for: self browser! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 2/7/2010 13:06'! currentOrRootNode ^ node! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 1/21/2010 15:08'! environment ^ BrowserEnvironment new! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 2/7/2010 12:26'! factory self subclassResponsibility! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 2/7/2010 13:14'! isSelected: aNode ^ node = aNode! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/21/2010 08:44'! model "Answer the smalltalk model." ^ model! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 2/7/2010 13:13'! node: aNode node := target := aNode! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 6/11/2010 18:53'! node: aNode selection: aStringOrInterval self node: aNode. target := OBTextSelection on: (aStringOrInterval isString ifFalse: [ aStringOrInterval ] ifTrue: [ RBParseTreeSearcher new matches: aStringOrInterval do: [ :each :answer | each sourceInterval ]; executeTree: (RBParser parseMethod: aNode definition text) ]) inText: aNode definition text! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 2/25/2010 08:50'! node: aNode start: aStartString stop: aStopString | start stop | start := aNode definition text asString findString: aStartString. stop := aNode definition text asString findString: aStopString. self node: aNode selection: (start to: stop + aStopString size - 1) ! ! !ORCmdRefactoringTest methodsFor: 'accessing-model' stamp: 'lr 1/21/2010 16:04'! parseTree: aSelector for: aSymbolOrBehavior | class method | class := self classFor: aSymbolOrBehavior. class ifNil: [ ^ nil ]. method := class methodFor: aSelector. method ifNil: [ ^ nil ]. ^ method parseTree! ! !ORCmdRefactoringTest methodsFor: 'utilities' stamp: 'lr 2/7/2010 13:01'! performRefactoringUsing: anInteractionArray | command | command := self command. command model: self model. self assert: command isActive description: command printString , ' is not active'. self assert: command isEnabled description: command printString , ' is not enabled'. self interactions: anInteractionArray do: [ command execute ]! ! !ORCmdRefactoringTest methodsFor: 'running' stamp: 'lr 1/21/2010 15:23'! runCase | prompt | prompt := ORCommand promptOnRefactoring. ORCommand promptOnRefactoring: true. [ super runCase ] ensure: [ ORCommand promptOnRefactoring: prompt ]! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 2/7/2010 13:32'! selectedClass ^ node theClass! ! !ORCmdRefactoringTest methodsFor: 'running' stamp: 'lr 2/7/2010 13:13'! setUp super setUp. model := RBNamespace new! ! !ORCmdRefactoringTest methodsFor: 'testing' stamp: 'lr 1/21/2010 08:47'! testModel self assert: (self command model notNil). self assert: (self command description includesSubString: self command label)! ! !ORCmdRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 12:49'! testTakesNodes self assert: self command takesNodes! ! !ORCmdRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 12:49'! testTakesText self assert: self command takesText! ! ORCmdRefactoringTest subclass: #ORCmdSourceRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdSourceRefactoringTest subclass: #ORCmdCreateCascadeRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdCreateCascadeRefactoringTest methodsFor: 'accessing' stamp: 'lr 2/25/2010 08:33'! factory ^ ORCmdCreateCascadeRefactoring! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 08:45'! methodWithAssignment | temp | self foo. self bar. temp := self zork. ^ temp! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 08:54'! methodWithCascade self foo; bar. self zork! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 08:45'! methodWithReturn self foo. self bar. ^ self zork! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 08:50'! methodWithSequence self foo. self bar. self zork! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 08:53'! methodWithSideEffect self foo bar. self foo zork! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:52'! testRefactoringAssignment self node: (OBMethodNode on: #methodWithAssignment inClass: self class) start: 'self foo' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithAssignment for: self class) = (RBParser parseMethod: 'methodWithAssignment | temp | temp := self foo; bar; zork. ^ temp')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:52'! testRefactoringAssignmentPartial self node: (OBMethodNode on: #methodWithAssignment inClass: self class) start: 'self bar' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithAssignment for: self class) = (RBParser parseMethod: 'methodWithAssignment | temp | self foo. temp := self bar; zork. ^ temp')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:55'! testRefactoringCascade self node: (OBMethodNode on: #methodWithCascade inClass: self class) start: 'self foo' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithCascade for: self class) = (RBParser parseMethod: 'methodWithCascade self foo; bar; zork')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:50'! testRefactoringReturn self node: (OBMethodNode on: #methodWithReturn inClass: self class) start: 'self foo' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithReturn for: self class) = (RBParser parseMethod: 'methodWithReturn ^ self foo; bar; zork')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:51'! testRefactoringReturnPartial self node: (OBMethodNode on: #methodWithReturn inClass: self class) start: 'self bar' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithReturn for: self class) = (RBParser parseMethod: 'methodWithReturn self foo. ^ self bar; zork')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:46'! testRefactoringSequence self node: (OBMethodNode on: #methodWithSequence inClass: self class) start: 'self foo' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithSequence for: self class) = (RBParser parseMethod: 'methodWithSequence self foo; bar; zork')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:51'! testRefactoringSequencePartial self node: (OBMethodNode on: #methodWithSequence inClass: self class) start: 'self bar' stop: 'self zork'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithSequence for: self class) = (RBParser parseMethod: 'methodWithSequence self foo. self bar; zork')! ! !ORCmdCreateCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 08:54'! testRefactoringSideEffect self node: (OBMethodNode on: #methodWithSideEffect inClass: self class) start: 'self foo bar' stop: 'self foo zork'. self performRefactoringUsing: { OBConfirmationRequest. true } , self browserRequestInteraction. self assert: (self parseTree: #methodWithSideEffect for: self class) = (RBParser parseMethod: 'methodWithSideEffect self foo bar; zork')! ! ORCmdSourceRefactoringTest subclass: #ORCmdExtractMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdExtractMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdExtractMethodRefactoring! ! !ORCmdExtractMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 13:33'! methodToExtractSomethingFrom ^ 1 + 2 + 3! ! !ORCmdExtractMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 6/15/2010 10:55'! testRefactoring self node: (OBMethodNode on: #methodToExtractSomethingFrom inClass: self class) selection: '1 + 2'. self performRefactoringUsing: {ORMethodNameRequest. RBMethodName selector: #extractedMethod arguments: #()} , self browserRequestInteraction. self assert: (self parseTree: #methodToExtractSomethingFrom for: self class) = (RBParser parseMethod: 'methodToExtractSomethingFrom ^ self extractedMethod + 3'). self assert: (self parseTree: #extractedMethod for: self class) = (RBParser parseMethod: 'extractedMethod ^ 1 + 2')! ! ORCmdSourceRefactoringTest subclass: #ORCmdExtractMethodToComponentRefactoringTest instanceVariableNames: 'delegate' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdExtractMethodToComponentRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdExtractMethodToComponentRefactoring! ! !ORCmdExtractMethodToComponentRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 13:51'! methodToExtractSomethingFrom ^ 1 + 2 + 3! ! !ORCmdExtractMethodToComponentRefactoringTest methodsFor: 'testing' stamp: 'lr 6/15/2010 10:55'! testRefactoring self node: (OBMethodNode on: #methodToExtractSomethingFrom inClass: self class) selection: '1 + 2'. self performRefactoringUsing: { OBChoiceRequest. 'delegate'. OBMultiLineTextRequest. 'ORCmdExtractMethodRefactoringTest'. ORMethodNameRequest. RBMethodName selector: #extractedMethod arguments: #() } , self browserRequestInteraction. self assert: (self parseTree: #methodToExtractSomethingFrom for: self class) = (RBParser parseMethod: 'methodToExtractSomethingFrom ^ delegate extractedMethod + 3'). self assert: (self parseTree: #extractedMethod for: ORCmdExtractMethodRefactoringTest) = (RBParser parseMethod: 'extractedMethod ^ 1 + 2')! ! ORCmdSourceRefactoringTest subclass: #ORCmdExtractToTemporaryRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdExtractToTemporaryRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdExtractToTemporaryRefactoring! ! !ORCmdExtractToTemporaryRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 13:37'! methodToExtractSomethingFrom ^ 1 + 2 + 3! ! !ORCmdExtractToTemporaryRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 13:38'! testRefactoring self node: (OBMethodNode on: #methodToExtractSomethingFrom inClass: self class) selection: '1 + 2'. self performRefactoringUsing: {OBTextRequest. 'temp'} , self browserRequestInteraction. self assert: (self parseTree: #methodToExtractSomethingFrom for: self class) = (RBParser parseMethod: 'methodToExtractSomethingFrom | temp | temp := 1 + 2. ^ temp + 3')! ! ORCmdSourceRefactoringTest subclass: #ORCmdInlineMethodFromComponentRefactoringTest instanceVariableNames: 'delegate' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineMethodFromComponentRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineMethodFromComponentRefactoring! ! !ORCmdInlineMethodFromComponentRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:01'! methodToPerformInlining ^ delegate methodToExtractSomethingFrom! ! !ORCmdInlineMethodFromComponentRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:03'! testRefactoring self node: (OBMethodNode on: #methodToPerformInlining inClass: self class) selection: 'delegate methodToExtractSomethingFrom'. self performRefactoringUsing: { OBChoiceRequest. 'ORCmdExtractMethodRefactoringTest' } , self browserRequestInteraction. self assert: (self parseTree: #methodToPerformInlining for: self class) = (RBParser parseMethod: ' methodToPerformInlining ^ 1 + 2 + 3')! ! ORCmdSourceRefactoringTest subclass: #ORCmdInlineMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineMethodRefactoring! ! !ORCmdInlineMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:03'! methodToInline ^ 1 + 2! ! !ORCmdInlineMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:04'! methodToPerformInlining ^ self methodToInline + 3! ! !ORCmdInlineMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:04'! testRefactoring self node: (OBMethodNode on: #methodToPerformInlining inClass: self class) selection: 'self methodToInline'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodToPerformInlining for: self class) = (RBParser parseMethod: 'methodToPerformInlining ^ 1 + 2 + 3')! ! ORCmdSourceRefactoringTest subclass: #ORCmdInlineTemporaryRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineTemporaryRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineTemporaryRefactoring! ! !ORCmdInlineTemporaryRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:05'! methodToInlineTemporary | temp | temp := 1 + 2. ^ temp + 3! ! !ORCmdInlineTemporaryRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:06'! testRefactoring self node: (OBMethodNode on: #methodToInlineTemporary inClass: self class) selection: 'temp := 1 + 2'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodToInlineTemporary for: self class) = (RBParser parseMethod: 'methodToInlineTemporary ^ 1 + 2 + 3')! ! ORCmdSourceRefactoringTest subclass: #ORCmdMoveVariableDefinitionRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdMoveVariableDefinitionRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdMoveVariableDefinitionRefactoring! ! !ORCmdMoveVariableDefinitionRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:16'! methodWithTemporary | temp | [ temp := 1. ^ temp ] value! ! !ORCmdMoveVariableDefinitionRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:16'! testRefactoring self node: (OBMethodNode on: #methodWithTemporary inClass: self class) selection: 'temp'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithTemporary for: self class) = (RBParser parseMethod: 'methodWithTemporary [ | temp | temp := 1. ^ temp ] value')! ! ORCmdSourceRefactoringTest subclass: #ORCmdRenameTemporaryRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameTemporaryRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameTemporaryRefactoring! ! !ORCmdRenameTemporaryRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:17'! methodWithTemporary | temp | temp := 1 + 2. ^ temp! ! !ORCmdRenameTemporaryRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:18'! testRefactoring self node: (OBMethodNode on: #methodWithTemporary inClass: self class) selection: 'temp'. self performRefactoringUsing: { OBTextRequest. 'dummy' } , self browserRequestInteraction. self assert: (self parseTree: #methodWithTemporary for: self class) = (RBParser parseMethod: 'methodWithTemporary | dummy | dummy := 1 + 2. ^ dummy')! ! !ORCmdSourceRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:28'! isAbstract ^ self name = #ORCmdSourceRefactoringTest! ! !ORCmdSourceRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 12:48'! testTakesNodes self deny: self command takesNodes! ! ORCmdSourceRefactoringTest subclass: #ORCmdSplitCascadeRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdSplitCascadeRefactoringTest methodsFor: 'accessing' stamp: 'lr 2/25/2010 09:08'! factory ^ ORCmdSplitCascadeRefactoring! ! !ORCmdSplitCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 09:16'! methodWithAssignment | temp | temp := self foo; bar; zork. ^ temp! ! !ORCmdSplitCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 09:12'! methodWithCascade self foo; bar; zork! ! !ORCmdSplitCascadeRefactoringTest methodsFor: 'support' stamp: 'lr 2/25/2010 09:16'! methodWithReturn ^ self foo; bar; zork! ! !ORCmdSplitCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 09:17'! testRefactoringAssignment self node: (OBMethodNode on: #methodWithAssignment inClass: self class) start: ';' stop: ';'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithAssignment for: self class) = (RBParser parseMethod: 'methodWithAssignment | temp | self foo. temp := self bar; zork. ^ temp')! ! !ORCmdSplitCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 09:16'! testRefactoringCascade self node: (OBMethodNode on: #methodWithCascade inClass: self class) start: ';' stop: ';'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithCascade for: self class) = (RBParser parseMethod: 'methodWithCascade self foo. self bar; zork')! ! !ORCmdSplitCascadeRefactoringTest methodsFor: 'testing' stamp: 'lr 2/25/2010 09:16'! testRefactoringReturn self node: (OBMethodNode on: #methodWithReturn inClass: self class) start: ';' stop: ';'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithReturn for: self class) = (RBParser parseMethod: 'methodWithReturn self foo. ^ self bar; zork')! ! ORCmdSourceRefactoringTest subclass: #ORCmdTemporaryToInstvarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdTemporaryToInstvarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdTemporaryToInstvarRefactoring! ! !ORCmdTemporaryToInstvarRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 14:18'! methodWithTemporary | temp | temp := 1 + 2. ^ temp! ! !ORCmdTemporaryToInstvarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 14:19'! testRefactoring self node: (OBMethodNode on: #methodWithTemporary inClass: self class) selection: 'temp'. self performRefactoringUsing: self browserRequestInteraction. self assert: (self parseTree: #methodWithTemporary for: self class) = (RBParser parseMethod: 'methodWithTemporary temp := 1 + 2. ^ temp'). self assert: ((self classFor: self class) instanceVariableNames includes: 'temp')! ! !ORCommandTest class methodsFor: 'testing' stamp: 'lr 1/21/2010 08:56'! isAbstract ^ self name = #ORCommandTest! ! !ORCommandTest class methodsFor: 'as yet unclassified' stamp: 'lr 2/7/2010 12:45'! packageNamesUnderTest ^ #('OB-Refactory')! ! !ORCommandTest methodsFor: 'utilities' stamp: 'lr 1/21/2010 15:53'! interaction: aRequest on: aStream | class answer | self assert: aStream atEnd not description: 'No interaction expected, but got ' , aRequest class name. class := aStream next. answer := aStream next. self assert: (class handles: aRequest) description: 'Interaction ' , class name , ' expected, but got ' , aRequest class name. aRequest resume: (answer isBlock ifTrue: [ answer value: aRequest ] ifFalse: [ answer ])! ! !ORCommandTest methodsFor: 'utilities' stamp: 'lr 1/21/2010 15:35'! interactionSet ^ (OBInteractionRequest allSubclasses copyWithout: OBWaitRequest) inject: ExceptionSet new into: [ :result :each | result , each ]! ! !ORCommandTest methodsFor: 'utilities' stamp: 'lr 1/21/2010 15:53'! interactions: anArray do: aBlock "Automatically handles a series of interaction requests during the evaluation of aBlock. anArray contains pairs with the interaction class and a handler block or resumption value." | interactions result | interactions := anArray readStream. result := aBlock on: self interactionSet do: [ :request | self interaction: request on: interactions ]. self assert: interactions atEnd description: 'More interactions expected'. ^ result! ! !ORCommandTest methodsFor: 'tests' stamp: 'lr 1/21/2010 09:02'! test01LabelIsString super test01LabelIsString. self deny: self command label isEmpty! ! !ORCommandTest methodsFor: 'tests' stamp: 'lr 1/21/2010 09:03'! test02LongDescriptionIsString self assert: self command longDescription isString. self assert: self command longDescription notEmpty! ! !ORCommandTest methodsFor: 'tests' stamp: 'lr 1/21/2010 09:03'! test03ClusterIsSymbol self assert: self command cluster isSymbol. self assert: self command cluster notEmpty! !