-
-
Notifications
You must be signed in to change notification settings - Fork 353
/
RBRemoveInstanceVariableTest.class.st
45 lines (41 loc) · 1.43 KB
/
RBRemoveInstanceVariableTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Class {
#name : #RBRemoveInstanceVariableTest,
#superclass : #RBRefactoringTest,
#category : #'Refactoring-Tests-Core'
}
{ #category : #tests }
RBRemoveInstanceVariableTest >> testModelRemoveInstanceVariable [
| class |
model
defineClass: 'nil subclass: #Object instanceVariableNames: ''foo1'' classVariableNames: '''' poolDictionaries: '''' category: #''Refactory-Test data'''.
class := model classNamed: #Object.
self assert: (class definesInstanceVariable: 'foo1').
self executeRefactoring: (RBRemoveInstanceVariableRefactoring
model: model
variable: 'foo1'
class: class).
self deny: (class definesInstanceVariable: 'foo1')
]
{ #category : #'failure tests' }
RBRemoveInstanceVariableTest >> testNonExistantName [
self shouldFail: (RBRemoveInstanceVariableRefactoring
variable: 'name1'
class: RBLintRuleTestData)
]
{ #category : #'failure tests' }
RBRemoveInstanceVariableTest >> testReferencedVariable [
self shouldFail: (RBRemoveInstanceVariableRefactoring
variable: 'name'
class: RBLintRuleTestData)
]
{ #category : #tests }
RBRemoveInstanceVariableTest >> testRemoveInstVar [
| refactoring class |
refactoring := RBRemoveInstanceVariableRefactoring
variable: 'foo1'
class: RBLintRuleTestData.
class := refactoring model classNamed: #RBLintRuleTestData.
self assert: (class definesInstanceVariable: 'foo1').
self executeRefactoring: refactoring.
self deny: (class definesInstanceVariable: 'foo1')
]