@@ -80,6 +80,102 @@ public void ObsoleteCallStatement_DoesNotReturnResult()
80
80
Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
81
81
}
82
82
83
+ [ TestMethod ]
84
+ [ TestCategory ( "Inspections" ) ]
85
+ public void ObsoleteCallStatement_DoesNotReturnResult_InstructionSeparator ( )
86
+ {
87
+ const string inputCode =
88
+ @"Sub Foo()
89
+ Call Foo: Foo
90
+ End Sub" ;
91
+
92
+ //Arrange
93
+ var settings = new Mock < IGeneralConfigService > ( ) ;
94
+ var config = GetTestConfig ( ) ;
95
+ settings . Setup ( x => x . LoadConfiguration ( ) ) . Returns ( config ) ;
96
+
97
+ var builder = new MockVbeBuilder ( ) ;
98
+ VBComponent component ;
99
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component ) ;
100
+ var mockHost = new Mock < IHostApplication > ( ) ;
101
+ mockHost . SetupAllProperties ( ) ;
102
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( ) ) ;
103
+
104
+ parser . Parse ( ) ;
105
+ if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
106
+
107
+ var inspection = new ObsoleteCallStatementInspection ( parser . State ) ;
108
+ var inspector = new Inspector ( settings . Object , new IInspection [ ] { inspection } ) ;
109
+
110
+ var inspectionResults = inspector . FindIssuesAsync ( parser . State , CancellationToken . None ) . Result ;
111
+
112
+ Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
113
+ }
114
+
115
+ [ TestMethod ]
116
+ [ TestCategory ( "Inspections" ) ]
117
+ public void ObsoleteCallStatement_ReturnsResult_ColonInComment ( )
118
+ {
119
+ const string inputCode =
120
+ @"Sub Foo()
121
+ Call Foo ' I''ve got a colon: see?
122
+ End Sub" ;
123
+
124
+ //Arrange
125
+ var settings = new Mock < IGeneralConfigService > ( ) ;
126
+ var config = GetTestConfig ( ) ;
127
+ settings . Setup ( x => x . LoadConfiguration ( ) ) . Returns ( config ) ;
128
+
129
+ var builder = new MockVbeBuilder ( ) ;
130
+ VBComponent component ;
131
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component ) ;
132
+ var mockHost = new Mock < IHostApplication > ( ) ;
133
+ mockHost . SetupAllProperties ( ) ;
134
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( ) ) ;
135
+
136
+ parser . Parse ( ) ;
137
+ if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
138
+
139
+ var inspection = new ObsoleteCallStatementInspection ( parser . State ) ;
140
+ var inspector = new Inspector ( settings . Object , new IInspection [ ] { inspection } ) ;
141
+
142
+ var inspectionResults = inspector . FindIssuesAsync ( parser . State , CancellationToken . None ) . Result ;
143
+
144
+ Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
145
+ }
146
+
147
+ [ TestMethod ]
148
+ [ TestCategory ( "Inspections" ) ]
149
+ public void ObsoleteCallStatement_ReturnsResult_ColonInStringLiteral ( )
150
+ {
151
+ const string inputCode =
152
+ @"Sub Foo(ByVal str As String)
153
+ Call Foo("":"")
154
+ End Sub" ;
155
+
156
+ //Arrange
157
+ var settings = new Mock < IGeneralConfigService > ( ) ;
158
+ var config = GetTestConfig ( ) ;
159
+ settings . Setup ( x => x . LoadConfiguration ( ) ) . Returns ( config ) ;
160
+
161
+ var builder = new MockVbeBuilder ( ) ;
162
+ VBComponent component ;
163
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component ) ;
164
+ var mockHost = new Mock < IHostApplication > ( ) ;
165
+ mockHost . SetupAllProperties ( ) ;
166
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( ) ) ;
167
+
168
+ parser . Parse ( ) ;
169
+ if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
170
+
171
+ var inspection = new ObsoleteCallStatementInspection ( parser . State ) ;
172
+ var inspector = new Inspector ( settings . Object , new IInspection [ ] { inspection } ) ;
173
+
174
+ var inspectionResults = inspector . FindIssuesAsync ( parser . State , CancellationToken . None ) . Result ;
175
+
176
+ Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
177
+ }
178
+
83
179
[ TestMethod ]
84
180
[ TestCategory ( "Inspections" ) ]
85
181
public void ObsoleteCallStatement_ReturnsMultipleResults ( )
0 commit comments