Skip to content

Commit e22d518

Browse files
authored
Update Dependencies (#608)
* Fix platform dependency in some test cases String literals for the tests may include `\r` for line breaks when compiled on windows but not on mac. * Update Dependencies * More Fixes For Cross Plat Tests * Fix DataRow Test By Standardizing Line Endings * Standardize line endings instead of using indexof * Remove unused proj * Fix usage of ReplaceLineEndings
1 parent 6debd89 commit e22d518

File tree

9 files changed

+27
-70
lines changed

9 files changed

+27
-70
lines changed

AppInspector.RulesEngine/AppInspector.RulesEngine.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<ItemGroup>
3333
<PackageReference Include="gstocco.YamlDotNet.YamlPath" Version="1.0.26" />
3434
<PackageReference Include="JsonCons.JsonPath" Version="1.1.0" />
35-
<PackageReference Include="Microsoft.CST.OAT" Version="1.2.73" />
36-
<PackageReference Include="Microsoft.CST.RecursiveExtractor" Version="1.2.37" />
35+
<PackageReference Include="Microsoft.CST.OAT" Version="1.2.77" />
36+
<PackageReference Include="Microsoft.CST.RecursiveExtractor" Version="1.2.40" />
3737
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.4" />
3838
<PackageReference Include="YamlDotNet" Version="16.3.0" />
3939
</ItemGroup>

AppInspector.Tests.CLI/AppInspector.Tests.CLI.csproj

Lines changed: 0 additions & 19 deletions
This file was deleted.

AppInspector.Tests.CLI/Logger/LogOptionsTests.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

AppInspector.Tests.CLI/UnitTest1.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

AppInspector.Tests/AppInspector.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
<ItemGroup>
153153
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
154154
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.13.1" />
155-
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.5.3" />
156-
<PackageReference Include="MSTest" Version="3.7.3" />
155+
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.6.3" />
156+
<PackageReference Include="MSTest" Version="3.8.3" />
157157
<PackageReference Include="System.Reflection" Version="4.3.0" />
158158
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
159159
</ItemGroup>

AppInspector.Tests/RuleProcessor/RegexWithIndexTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public class RegexWithIndexTests
188188
""description"": ""this rule finds race car split across two lines."",
189189
""patterns"": [
190190
{
191-
""pattern"": ""race\\r\\ncar"",
191+
""pattern"": ""race\\r?\\ncar"",
192192
""type"": ""regex"",
193193
""confidence"": ""High"",
194194
""modifiers"": [
@@ -214,7 +214,7 @@ public class RegexWithIndexTests
214214
""description"": ""this rule finds race car split across two lines."",
215215
""patterns"": [
216216
{
217-
""pattern"": ""race\\r\\ncar"",
217+
""pattern"": ""race\\r?\\ncar"",
218218
""type"": ""regex"",
219219
""confidence"": ""High"",
220220
""modifiers"": [

AppInspector.Tests/RuleProcessor/WithinClauseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ int main(int argc, char **argv)
278278
""conditions"": [
279279
{
280280
""pattern"": {
281-
""pattern"": ""free\\r\\n\\("",
281+
""pattern"": ""free\\r?\\n\\("",
282282
""type"": ""regex"",
283283
""scopes"": [
284284
""code""

AppInspector.Tests/RuleProcessor/XmlAndJsonTests.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ public void JsonStringRule(string rule)
344344
Assert.Fail();
345345
}
346346
}
347-
[DataRow(xmlStringRuleForPropWithDataForData, "Franklin", 212)]
348-
[DataRow(xmlStringRuleForPropWithData, "true", 176)]
347+
[DataRow(xmlStringRuleForPropWithDataForData, "Franklin", 209)]
348+
[DataRow(xmlStringRuleForPropWithData, "true", 173)]
349349
[DataTestMethod]
350350
public void XmlTagWithPropsAndValue(string rule, string expectedValue, int expectedIndex)
351351
{
@@ -355,7 +355,7 @@ public void XmlTagWithPropsAndValue(string rule, string expectedValue, int expec
355355
new RuleProcessorOptions { AllowAllTagsInBuildFiles = true });
356356
if (_languages.FromFileNameOut("test.xml", out var info))
357357
{
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);
359359
Assert.AreEqual(1, matches.Count);
360360
var match = matches[0];
361361
Assert.AreEqual(expectedValue, match.Sample);
@@ -432,9 +432,10 @@ public void JsonBooleanRule()
432432
new RuleProcessorOptions { Parallel = false, AllowAllTagsInBuildFiles = true });
433433
if (_languages.FromFileNameOut("test.json", out var info))
434434
{
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);
436436
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);
438439
}
439440
}
440441

@@ -639,6 +640,7 @@ public void TestMultiDocYaml()
639640
]
640641
}
641642
]";
643+
string standardizedContent = content.ReplaceLineEndings("\n");
642644
RuleSet rules = new();
643645
var originalSource = "TestRules";
644646
rules.AddString(rule, originalSource);
@@ -650,19 +652,19 @@ public void TestMultiDocYaml()
650652
new RuleProcessorOptions { Parallel = false, AllowAllTagsInBuildFiles = true });
651653
if (_languages.FromFileNameOut("test.yml", out var info))
652654
{
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);
654656
Assert.AreEqual(2, matches.Count);
655657
Assert.AreEqual("ok", matches[0].Sample);
656-
Assert.AreEqual(185, matches[0].Boundary.Index);
658+
Assert.AreEqual(172, matches[0].Boundary.Index);
657659
Assert.AreEqual(2, matches[0].Boundary.Length);
658-
Assert.AreEqual(372, matches[1].Boundary.Index);
660+
Assert.AreEqual(346, matches[1].Boundary.Index);
659661
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);
661663
Assert.AreEqual(2, matches2.Count);
662664
Assert.AreEqual("ok", matches2[0].Sample);
663-
Assert.AreEqual(185, matches[0].Boundary.Index);
665+
Assert.AreEqual(172, matches[0].Boundary.Index);
664666
Assert.AreEqual(2, matches[0].Boundary.Length);
665-
Assert.AreEqual(372, matches[1].Boundary.Index);
667+
Assert.AreEqual(346, matches[1].Boundary.Index);
666668
Assert.AreEqual(2, matches[1].Boundary.Length);
667669
}
668670
}
@@ -740,6 +742,7 @@ public void TestYamlWithIndexLocation()
740742
]
741743
}
742744
]";
745+
string standardizedContent = content.ReplaceLineEndings("\n");
743746
RuleSet rules = new();
744747
var originalSource = "TestRules";
745748
rules.AddString(rule, originalSource);
@@ -751,15 +754,15 @@ public void TestYamlWithIndexLocation()
751754
new RuleProcessorOptions { Parallel = false, AllowAllTagsInBuildFiles = true });
752755
if (_languages.FromFileNameOut("test.yml", out var info))
753756
{
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);
755758
Assert.AreEqual(1, matches.Count);
756759
Assert.AreEqual("ok", matches[0].Sample);
757-
Assert.AreEqual(178, matches[0].Boundary.Index);
760+
Assert.AreEqual(167, matches[0].Boundary.Index);
758761
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);
760763
Assert.AreEqual(1, matches2.Count);
761764
Assert.AreEqual("ok", matches2[0].Sample);
762-
Assert.AreEqual(178, matches2[0].Boundary.Index);
765+
Assert.AreEqual(167, matches[0].Boundary.Index);
763766
Assert.AreEqual(2, matches2[0].Boundary.Length);
764767
}
765768
}

AppInspector/AppInspector.Commands.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
<PackageReference Include="DotLiquid" Version="2.3.197" />
5656
<PackageReference Include="Glob" Version="1.1.9" />
5757
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
58-
<PackageReference Include="Microsoft.CST.OAT" Version="1.2.73" />
59-
<PackageReference Include="Microsoft.CST.RecursiveExtractor" Version="1.2.37" />
58+
<PackageReference Include="Microsoft.CST.OAT" Version="1.2.77" />
59+
<PackageReference Include="Microsoft.CST.RecursiveExtractor" Version="1.2.40" />
6060
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.4" />
6161
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
6262
<PackageReference Include="System.Reflection.Metadata" Version="9.0.4" />

0 commit comments

Comments
 (0)