File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
RubberduckTests/SmartIndenter Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ internal class AbsoluteCodeLine
14
14
private static readonly Regex StringReplaceRegex = new Regex ( StringPlaceholder ) ;
15
15
private static readonly Regex LineNumberRegex = new Regex ( @"^(?<number>\d+)\s+(?<code>.*)" , RegexOptions . ExplicitCapture ) ;
16
16
private static readonly Regex EndOfLineCommentRegex = new Regex ( @"^(?!(Rem\s)|('))(?<code>.*)(\s(?<comment>'.*))$" , RegexOptions . ExplicitCapture ) ;
17
- private static readonly Regex ProcedureStartRegex = new Regex ( @"^(Public\s|Private\s|Friend\s)?(Static\s)?(Sub|Function|Property\s(Let|Get|Set))" ) ;
17
+ private static readonly Regex ProcedureStartRegex = new Regex ( @"^(Public\s|Private\s|Friend\s)?(Static\s)?(Sub|Function|Property\s(Let|Get|Set))\s " ) ;
18
18
private static readonly Regex ProcedureStartIgnoreRegex = new Regex ( @"^[LR]?Set\s|^Let\s|^(Public|Private)\sDeclare\s(Function|Sub)" ) ;
19
19
private static readonly Regex ProcedureEndRegex = new Regex ( @"^End\s(Sub|Function|Property)" ) ;
20
20
private static readonly Regex TypeEnumStartRegex = new Regex ( @"^(Public\s|Private\s)?(Enum\s|Type\s)" ) ;
Original file line number Diff line number Diff line change @@ -435,5 +435,33 @@ public void OverIndentationLeftAligns()
435
435
var actual = indenter . Indent ( code , string . Empty ) ;
436
436
Assert . IsTrue ( expected . SequenceEqual ( actual ) ) ;
437
437
}
438
+
439
+ //http://chat.stackexchange.com/transcript/message/33575758#33575758
440
+ [ TestMethod ]
441
+ [ TestCategory ( "Indenter" ) ]
442
+ public void SubFooTokenIsNotInterpretedAsProcedureStart ( )
443
+ {
444
+ var code = new [ ]
445
+ {
446
+ "Public Sub Test()" ,
447
+ "If Subject = 0 Then" ,
448
+ "Subject = 1" ,
449
+ "End If" ,
450
+ "End Sub"
451
+ } ;
452
+
453
+ var expected = new [ ]
454
+ {
455
+ "Public Sub Test()" ,
456
+ " If Subject = 0 Then" ,
457
+ " Subject = 1" ,
458
+ " End If" ,
459
+ "End Sub"
460
+ } ;
461
+
462
+ var indenter = new Indenter ( null , ( ) => IndenterSettingsTests . GetMockIndenterSettings ( ) ) ;
463
+ var actual = indenter . Indent ( code , string . Empty ) ;
464
+ Assert . IsTrue ( expected . SequenceEqual ( actual ) ) ;
465
+ }
438
466
}
439
467
}
You can’t perform that action at this time.
0 commit comments