@@ -344,8 +344,8 @@ public void JsonStringRule(string rule)
344
344
Assert . Fail ( ) ;
345
345
}
346
346
}
347
- [ DataRow ( xmlStringRuleForPropWithDataForData , "Franklin" , 212 ) ]
348
- [ DataRow ( xmlStringRuleForPropWithData , "true" , 176 ) ]
347
+ [ DataRow ( xmlStringRuleForPropWithDataForData , "Franklin" , 209 ) ]
348
+ [ DataRow ( xmlStringRuleForPropWithData , "true" , 173 ) ]
349
349
[ DataTestMethod ]
350
350
public void XmlTagWithPropsAndValue ( string rule , string expectedValue , int expectedIndex )
351
351
{
@@ -355,7 +355,7 @@ public void XmlTagWithPropsAndValue(string rule, string expectedValue, int expec
355
355
new RuleProcessorOptions { AllowAllTagsInBuildFiles = true } ) ;
356
356
if ( _languages . FromFileNameOut ( "test.xml" , out var info ) )
357
357
{
358
- var matches = processor . AnalyzeFile ( xmlDataPropsWithTagValue , new FileEntry ( "test.xml" , new MemoryStream ( ) ) , info ) ;
358
+ var matches = processor . AnalyzeFile ( xmlDataPropsWithTagValue . ReplaceLineEndings ( " \n " ) , new FileEntry ( "test.xml" , new MemoryStream ( ) ) , info ) ;
359
359
Assert . AreEqual ( 1 , matches . Count ) ;
360
360
var match = matches [ 0 ] ;
361
361
Assert . AreEqual ( expectedValue , match . Sample ) ;
@@ -432,9 +432,10 @@ public void JsonBooleanRule()
432
432
new RuleProcessorOptions { Parallel = false , AllowAllTagsInBuildFiles = true } ) ;
433
433
if ( _languages . FromFileNameOut ( "test.json" , out var info ) )
434
434
{
435
- var matches = analyzer . AnalyzeFile ( testContent , new FileEntry ( "test.json" , new MemoryStream ( ) ) , info ) ;
435
+ var matches = analyzer . AnalyzeFile ( testContent . ReplaceLineEndings ( " \n " ) , new FileEntry ( "test.json" , new MemoryStream ( ) ) , info ) ;
436
436
Assert . AreEqual ( 1 , matches . Count ) ;
437
- Assert . AreEqual ( 237 , matches [ 0 ] . Boundary . Index ) ;
437
+ Assert . AreEqual ( 226 , matches [ 0 ] . Boundary . Index ) ;
438
+ Assert . AreEqual ( "true" , matches [ 0 ] . Sample ) ;
438
439
}
439
440
}
440
441
@@ -639,6 +640,7 @@ public void TestMultiDocYaml()
639
640
]
640
641
}
641
642
]" ;
643
+ string standardizedContent = content . ReplaceLineEndings ( "\n " ) ;
642
644
RuleSet rules = new ( ) ;
643
645
var originalSource = "TestRules" ;
644
646
rules . AddString ( rule , originalSource ) ;
@@ -650,19 +652,19 @@ public void TestMultiDocYaml()
650
652
new RuleProcessorOptions { Parallel = false , AllowAllTagsInBuildFiles = true } ) ;
651
653
if ( _languages . FromFileNameOut ( "test.yml" , out var info ) )
652
654
{
653
- var matches = analyzer . AnalyzeFile ( content , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
655
+ var matches = analyzer . AnalyzeFile ( standardizedContent , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
654
656
Assert . AreEqual ( 2 , matches . Count ) ;
655
657
Assert . AreEqual ( "ok" , matches [ 0 ] . Sample ) ;
656
- Assert . AreEqual ( 185 , matches [ 0 ] . Boundary . Index ) ;
658
+ Assert . AreEqual ( 172 , matches [ 0 ] . Boundary . Index ) ;
657
659
Assert . AreEqual ( 2 , matches [ 0 ] . Boundary . Length ) ;
658
- Assert . AreEqual ( 372 , matches [ 1 ] . Boundary . Index ) ;
660
+ Assert . AreEqual ( 346 , matches [ 1 ] . Boundary . Index ) ;
659
661
Assert . AreEqual ( 2 , matches [ 1 ] . Boundary . Length ) ;
660
- var matches2 = analyzer2 . AnalyzeFile ( content , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
662
+ var matches2 = analyzer2 . AnalyzeFile ( standardizedContent , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
661
663
Assert . AreEqual ( 2 , matches2 . Count ) ;
662
664
Assert . AreEqual ( "ok" , matches2 [ 0 ] . Sample ) ;
663
- Assert . AreEqual ( 185 , matches [ 0 ] . Boundary . Index ) ;
665
+ Assert . AreEqual ( 172 , matches [ 0 ] . Boundary . Index ) ;
664
666
Assert . AreEqual ( 2 , matches [ 0 ] . Boundary . Length ) ;
665
- Assert . AreEqual ( 372 , matches [ 1 ] . Boundary . Index ) ;
667
+ Assert . AreEqual ( 346 , matches [ 1 ] . Boundary . Index ) ;
666
668
Assert . AreEqual ( 2 , matches [ 1 ] . Boundary . Length ) ;
667
669
}
668
670
}
@@ -740,6 +742,7 @@ public void TestYamlWithIndexLocation()
740
742
]
741
743
}
742
744
]" ;
745
+ string standardizedContent = content . ReplaceLineEndings ( "\n " ) ;
743
746
RuleSet rules = new ( ) ;
744
747
var originalSource = "TestRules" ;
745
748
rules . AddString ( rule , originalSource ) ;
@@ -751,15 +754,15 @@ public void TestYamlWithIndexLocation()
751
754
new RuleProcessorOptions { Parallel = false , AllowAllTagsInBuildFiles = true } ) ;
752
755
if ( _languages . FromFileNameOut ( "test.yml" , out var info ) )
753
756
{
754
- var matches = analyzer . AnalyzeFile ( content , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
757
+ var matches = analyzer . AnalyzeFile ( standardizedContent , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
755
758
Assert . AreEqual ( 1 , matches . Count ) ;
756
759
Assert . AreEqual ( "ok" , matches [ 0 ] . Sample ) ;
757
- Assert . AreEqual ( 178 , matches [ 0 ] . Boundary . Index ) ;
760
+ Assert . AreEqual ( 167 , matches [ 0 ] . Boundary . Index ) ;
758
761
Assert . AreEqual ( 2 , matches [ 0 ] . Boundary . Length ) ;
759
- var matches2 = analyzer2 . AnalyzeFile ( content , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
762
+ var matches2 = analyzer2 . AnalyzeFile ( standardizedContent , new FileEntry ( "test.yml" , new MemoryStream ( ) ) , info ) ;
760
763
Assert . AreEqual ( 1 , matches2 . Count ) ;
761
764
Assert . AreEqual ( "ok" , matches2 [ 0 ] . Sample ) ;
762
- Assert . AreEqual ( 178 , matches2 [ 0 ] . Boundary . Index ) ;
765
+ Assert . AreEqual ( 167 , matches [ 0 ] . Boundary . Index ) ;
763
766
Assert . AreEqual ( 2 , matches2 [ 0 ] . Boundary . Length ) ;
764
767
}
765
768
}
0 commit comments