@@ -71,6 +71,98 @@ End Sub"
71
71
PerformExpectedVersusActualRenameTests ( tdo , inputOutput ) ;
72
72
}
73
73
74
+ [ Test ]
75
+ [ Category ( "Refactorings" ) ]
76
+ [ Category ( "Rename" ) ]
77
+ //See issue #5277 at https://github.com/rubberduck-vba/Rubberduck/issues/5277
78
+ public void RenameRefactoring_RenameArray_FromDeclaration ( )
79
+ {
80
+ var tdo = new RenameTestsDataObject ( selectedIdentifier : "arr" , newName : "bar" ) ;
81
+ var inputOutput = new RenameTestModuleDefinition ( "Module1" , ComponentType . StandardModule )
82
+ {
83
+ Input =
84
+ @"Private Sub Foo()
85
+ Dim a|rr(0 To 1) As Integer
86
+ arr(1) = arr(0)
87
+ End Sub" ,
88
+ Expected =
89
+ @"Private Sub Foo()
90
+ Dim bar(0 To 1) As Integer
91
+ bar(1) = bar(0)
92
+ End Sub"
93
+ } ;
94
+ PerformExpectedVersusActualRenameTests ( tdo , inputOutput ) ;
95
+ }
96
+
97
+ [ Test ]
98
+ [ Category ( "Refactorings" ) ]
99
+ [ Category ( "Rename" ) ]
100
+ //See issue #5277 at https://github.com/rubberduck-vba/Rubberduck/issues/5277
101
+ public void RenameRefactoring_RenameReDimDeclaredArray_FromDeclaration ( )
102
+ {
103
+ var tdo = new RenameTestsDataObject ( selectedIdentifier : "arr" , newName : "bar" ) ;
104
+ var inputOutput = new RenameTestModuleDefinition ( "Module1" , ComponentType . StandardModule )
105
+ {
106
+ Input =
107
+ @"Private Sub Foo()
108
+ ReDim a|rr(0 To 1)
109
+ arr(1) = arr(0)
110
+ End Sub" ,
111
+ Expected =
112
+ @"Private Sub Foo()
113
+ ReDim bar(0 To 1)
114
+ bar(1) = bar(0)
115
+ End Sub"
116
+ } ;
117
+ PerformExpectedVersusActualRenameTests ( tdo , inputOutput ) ;
118
+ }
119
+
120
+ [ Test ]
121
+ [ Category ( "Refactorings" ) ]
122
+ [ Category ( "Rename" ) ]
123
+ //See issue #5277 at https://github.com/rubberduck-vba/Rubberduck/issues/5277
124
+ public void RenameRefactoring_RenameArray_FromReference ( )
125
+ {
126
+ var tdo = new RenameTestsDataObject ( selectedIdentifier : "arr" , newName : "bar" ) ;
127
+ var inputOutput = new RenameTestModuleDefinition ( "Module1" , ComponentType . StandardModule )
128
+ {
129
+ Input =
130
+ @"Private Sub Foo()
131
+ Dim arr(0 To 1) As Integer
132
+ arr(1) = ar|r(0)
133
+ End Sub" ,
134
+ Expected =
135
+ @"Private Sub Foo()
136
+ Dim bar(0 To 1) As Integer
137
+ bar(1) = bar(0)
138
+ End Sub"
139
+ } ;
140
+ PerformExpectedVersusActualRenameTests ( tdo , inputOutput ) ;
141
+ }
142
+
143
+ [ Test ]
144
+ [ Category ( "Refactorings" ) ]
145
+ [ Category ( "Rename" ) ]
146
+ //See issue #5277 at https://github.com/rubberduck-vba/Rubberduck/issues/5277
147
+ public void RenameRefactoring_RenameReDimDeclaredArray_FromReference ( )
148
+ {
149
+ var tdo = new RenameTestsDataObject ( selectedIdentifier : "arr" , newName : "bar" ) ;
150
+ var inputOutput = new RenameTestModuleDefinition ( "Module1" , ComponentType . StandardModule )
151
+ {
152
+ Input =
153
+ @"Private Sub Foo()
154
+ ReDim arr(0 To 1)
155
+ arr(1) = a|rr(0)
156
+ End Sub" ,
157
+ Expected =
158
+ @"Private Sub Foo()
159
+ ReDim bar(0 To 1)
160
+ bar(1) = bar(0)
161
+ End Sub"
162
+ } ;
163
+ PerformExpectedVersusActualRenameTests ( tdo , inputOutput ) ;
164
+ }
165
+
74
166
[ Test ]
75
167
[ Category ( "Refactorings" ) ]
76
168
[ Category ( "Rename" ) ]
0 commit comments