@@ -223,6 +223,19 @@ End Sub
223
223
AssertTree ( parseResult . Item1 , parseResult . Item2 , "//moduleOption" ) ;
224
224
}
225
225
226
+ [ TestMethod ]
227
+ public void TestModuleOption_Indented ( )
228
+ {
229
+ string code = @"
230
+ Option Explicit
231
+
232
+ Sub DoSomething()
233
+ End Sub
234
+ " ;
235
+ var parseResult = Parse ( code ) ;
236
+ AssertTree ( parseResult . Item1 , parseResult . Item2 , "//moduleOption" ) ;
237
+ }
238
+
226
239
[ TestMethod ]
227
240
public void TestModuleConfig ( )
228
241
{
@@ -928,6 +941,37 @@ Debug.Print 42
928
941
AssertTree ( parseResult . Item1 , parseResult . Item2 , "//subStmt" ) ;
929
942
}
930
943
944
+ [ TestMethod ]
945
+ public void TestFunction_Indented ( )
946
+ {
947
+ string code = @"
948
+ Private Function Foo() As Boolean
949
+ Foo = True
950
+ End Function" ;
951
+ var parseResult = Parse ( code ) ;
952
+ AssertTree ( parseResult . Item1 , parseResult . Item2 , "//functionStmt" ) ;
953
+ }
954
+
955
+ [ TestMethod ]
956
+ public void TestSub_Indented ( )
957
+ {
958
+ string code = @"
959
+ Private Sub Foo()
960
+ End Sub" ;
961
+ var parseResult = Parse ( code ) ;
962
+ AssertTree ( parseResult . Item1 , parseResult . Item2 , "//subStmt" ) ;
963
+ }
964
+
965
+ [ TestMethod ]
966
+ public void TestSub_InconsistentlyIndented ( )
967
+ {
968
+ string code = @"
969
+ Private Sub Foo()
970
+ End Sub" ;
971
+ var parseResult = Parse ( code ) ;
972
+ AssertTree ( parseResult . Item1 , parseResult . Item2 , "//subStmt" ) ;
973
+ }
974
+
931
975
[ TestMethod ]
932
976
public void TestPtrSafeAsVariable ( )
933
977
{
@@ -963,7 +1007,6 @@ private Tuple<VBAParser, ParserRuleContext> Parse(string code)
963
1007
// If SLL fails we want to get notified ASAP so we can fix it, that's why we don't retry using LL.
964
1008
parser . Interpreter . PredictionMode = PredictionMode . Sll ;
965
1009
var tree = parser . startRule ( ) ;
966
- var k = tree . ToStringTree ( parser ) ;
967
1010
return Tuple . Create < VBAParser , ParserRuleContext > ( parser , tree ) ;
968
1011
}
969
1012
0 commit comments