@@ -241,6 +241,46 @@ public void ObsoleteCommentSyntax_QuickFixWorks_UpdateComment()
241
241
Assert . AreEqual ( expectedCode , actualCode ) ;
242
242
}
243
243
244
+ [ TestMethod ]
245
+ [ TestCategory ( "Inspections" ) ]
246
+ public void ObsoleteCommentSyntax_QuickFixWorks_UpdateCommentHasContinuation ( )
247
+ {
248
+ const string inputCode =
249
+ @"Rem this is _
250
+ a comment" ;
251
+
252
+ const string expectedCode =
253
+ @"' this is _
254
+ a comment" ;
255
+
256
+ //Arrange
257
+ var settings = new Mock < IGeneralConfigService > ( ) ;
258
+ var config = GetTestConfig ( ) ;
259
+ settings . Setup ( x => x . LoadConfiguration ( ) ) . Returns ( config ) ;
260
+
261
+ var builder = new MockVbeBuilder ( ) ;
262
+ IVBComponent component ;
263
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component ) ;
264
+ var project = vbe . Object . VBProjects [ 0 ] ;
265
+ var module = project . VBComponents [ 0 ] . CodeModule ;
266
+ var mockHost = new Mock < IHostApplication > ( ) ;
267
+ mockHost . SetupAllProperties ( ) ;
268
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( new Mock < ISinks > ( ) . Object ) ) ;
269
+
270
+ parser . Parse ( new CancellationTokenSource ( ) ) ;
271
+ if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
272
+
273
+ var inspection = new ObsoleteCommentSyntaxInspection ( parser . State ) ;
274
+ var inspector = new Inspector ( settings . Object , new IInspection [ ] { inspection } ) ;
275
+
276
+ var inspectionResults = inspector . FindIssuesAsync ( parser . State , CancellationToken . None ) . Result ;
277
+
278
+ inspectionResults . First ( ) . QuickFixes . Single ( s => s is ReplaceObsoleteCommentMarkerQuickFix ) . Fix ( ) ;
279
+
280
+ var actualCode = module . Content ( ) ;
281
+ Assert . AreEqual ( expectedCode , actualCode ) ;
282
+ }
283
+
244
284
[ TestMethod ]
245
285
[ TestCategory ( "Inspections" ) ]
246
286
public void ObsoleteCommentSyntax_QuickFixWorks_RemoveComment ( )
@@ -354,6 +394,46 @@ public void ObsoleteCommentSyntax_QuickFixWorks_UpdateComment_LineHasCode()
354
394
Assert . AreEqual ( expectedCode , actualCode ) ;
355
395
}
356
396
397
+ [ TestMethod ]
398
+ [ TestCategory ( "Inspections" ) ]
399
+ public void ObsoleteCommentSyntax_QuickFixWorks_UpdateComment_LineHasCodeAndContinuation ( )
400
+ {
401
+ const string inputCode =
402
+ @"Dim Foo As Integer: Rem This is _
403
+ a comment" ;
404
+
405
+ const string expectedCode =
406
+ @"Dim Foo As Integer: ' This is _
407
+ a comment" ;
408
+
409
+ //Arrange
410
+ var settings = new Mock < IGeneralConfigService > ( ) ;
411
+ var config = GetTestConfig ( ) ;
412
+ settings . Setup ( x => x . LoadConfiguration ( ) ) . Returns ( config ) ;
413
+
414
+ var builder = new MockVbeBuilder ( ) ;
415
+ IVBComponent component ;
416
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component ) ;
417
+ var project = vbe . Object . VBProjects [ 0 ] ;
418
+ var module = project . VBComponents [ 0 ] . CodeModule ;
419
+ var mockHost = new Mock < IHostApplication > ( ) ;
420
+ mockHost . SetupAllProperties ( ) ;
421
+ var parser = MockParser . Create ( vbe . Object , new RubberduckParserState ( new Mock < ISinks > ( ) . Object ) ) ;
422
+
423
+ parser . Parse ( new CancellationTokenSource ( ) ) ;
424
+ if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
425
+
426
+ var inspection = new ObsoleteCommentSyntaxInspection ( parser . State ) ;
427
+ var inspector = new Inspector ( settings . Object , new IInspection [ ] { inspection } ) ;
428
+
429
+ var inspectionResults = inspector . FindIssuesAsync ( parser . State , CancellationToken . None ) . Result ;
430
+
431
+ inspectionResults . First ( ) . QuickFixes . Single ( s => s is ReplaceObsoleteCommentMarkerQuickFix ) . Fix ( ) ;
432
+
433
+ var actualCode = module . Content ( ) ;
434
+ Assert . AreEqual ( expectedCode , actualCode ) ;
435
+ }
436
+
357
437
[ TestMethod ]
358
438
[ TestCategory ( "Inspections" ) ]
359
439
public void ObsoleteCommentSyntax_QuickFixWorks_RemoveComment_LineHasCode ( )
0 commit comments