Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files array tests for nested files and uriBaseIds #1226

Merged
merged 8 commits into from
Jan 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Sarif.UnitTests/Sarif.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\Minimum.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithPropertiesAndTags.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithTwoRuns.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\NestedFiles.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\NotificationExceptionWithStack.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithBasicInvocation.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithFiles.sarif" />
Expand All @@ -84,9 +85,11 @@
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithRules.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\TwoResultsWithFixes.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\Inputs\UriBaseId.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\BasicResult.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\CodeFlows.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\Minimum.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NestedFiles.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithPropertiesAndTags.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithTwoRuns.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NotificationExceptionWithStack.sarif" />
Expand All @@ -98,6 +101,7 @@
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithRules.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\RestoreFromPropertyBag.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\TwoResultsWithFixes.sarif" />
<None Remove="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\UriBaseId.sarif" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -145,6 +149,7 @@
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\Minimum.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithPropertiesAndTags.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\MinimumWithTwoRuns.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\NestedFiles.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\NotificationExceptionWithStack.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithBasicInvocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithFiles.sarif" />
Expand All @@ -154,11 +159,13 @@
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\OneRunWithRules.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\TwoResultsWithFixes.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\Inputs\UriBaseId.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\BasicResult.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\CodeFlows.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\Minimum.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithPropertiesAndTags.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\MinimumWithTwoRuns.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NestedFiles.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\NotificationExceptionWithStack.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithBasicInvocation.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithFiles.sarif" />
Expand All @@ -168,6 +175,7 @@
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\OneRunWithRules.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\RestoreFromPropertyBag.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\TwoResultsWithFixes.sarif" />
<EmbeddedResource Include="TestData\SarifVersionOneToCurrentVisitor\ExpectedOutputs\UriBaseId.sarif" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -223,4 +231,6 @@
<None Include="$(SolutionDir)\Sarif.FunctionalTests\v2\SpecExamples\Comprehensive.sarif" CopyToOutputDirectory="PreserveNewest" LinkBase="v2\SpecExamples" />
<None Include="$(SolutionDir)\Sarif.FunctionalTests\v2\ObsoleteFormats\ComprehensivePrereleaseTwoZeroZero.sarif" CopyToOutputDirectory="PreserveNewest" LinkBase="v2\ObsoleteFormats" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"$schema": "http://json.schemastore.org/sarif-2.0.0-csd.2.beta.2018-11-28",
"version": "2.0.0-csd.2.beta.2018-11-28",
"runs": [
{
"tool": {
"name": "CodeScanner",
"semanticVersion": "2.1.0"
},
"files": [
{
"fileLocation": {
"uri": "/file.txt",
"fileIndex": 0
},
"parentIndex": 1,
"mimeType": "text/plain"
},
{
"fileLocation": {
"uri": "file:///c:/archive_one.zip",
"fileIndex": 1
},
"mimeType": "application/zip"
},
{
"fileLocation": {
"uri": "file.txt",
"fileIndex": 2
},
"mimeType": "text/plain"
},
{
"fileLocation": {
"uri": "/file.txt",
"fileIndex": 3
},
"parentIndex": 4,
"mimeType": "text/plain"
},
{
"fileLocation": {
"uri": "/archive_two.zip",
"fileIndex": 4
},
"parentIndex": 1,
"mimeType": "application/zip"
}
],
"results": [
{
"ruleId": "C1",
"message": {
"text": "a"
},
"locations": [
{
"physicalLocation": {
"fileLocation": {
"uri": "file.txt",
"fileIndex": 2
}
},
"properties": {
"key": "file.txt"
}
}
]
},
{
"ruleId": "C1",
"message": {
"text": "a"
},
"locations": [
{
"physicalLocation": {
"fileLocation": {
"uri": "/file.txt",
"fileIndex": 0
}
},
"properties": {
"key": "file://c:/archive_one.zip#/file.txt"
}
}
]
},
{
"ruleId": "C1",
"message": {
"text": "a"
},
"locations": [
{
"physicalLocation": {
"fileLocation": {
"uri": "/file.txt",
"fileIndex": 3
}
},
"properties": {
"key": "file://c:/archive_one.zip#/archive_two.zip/file.txt"
}
}
]
}
],
"columnKind": "utf16CodeUnits"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"$schema": "http://json.schemastore.org/sarif-2.0.0-csd.2.beta.2018-11-28",
"version": "2.0.0-csd.2.beta.2018-11-28",
"runs": [
{
"tool": {
"name": "CodeScanner",
"semanticVersion": "2.1.0"
},
"files": [
{
"fileLocation": {
"uri": "file.txt",
"fileIndex": 0
},
"mimeType": "text/plain"
},
{
"fileLocation": {
"uri": "file.txt",
"uriBaseId": "SRCROOT",
"fileIndex": 1
},
"mimeType": "text/plain"
},
{
"fileLocation": {
"uri": "file.txt",
"uriBaseId": "TESTROOT",
"fileIndex": 2
},
"mimeType": "text/plain"
}
],
"results": [
{
"ruleId": "C1",
"message": {
"text": "a"
},
"locations": [
{
"physicalLocation": {
"fileLocation": {
"uri": "file.txt",
"fileIndex": 0
}
},
"properties": {
"key": "file.txt"
}
}
]
},
{
"ruleId": "C1",
"message": {
"text": "a"
},
"locations": [
{
"physicalLocation": {
"fileLocation": {
"uri": "file.txt",
"uriBaseId": "SRCROOT",
"fileIndex": 1
}
},
"properties": {
"key": "#SRCROOT#file.txt"
}
}
]
},
{
"ruleId": "C1",
"message": {
"text": "a"
},
"locations": [
{
"physicalLocation": {
"fileLocation": {
"uri": "file.txt",
"uriBaseId": "TESTROOT",
"fileIndex": 2
}
},
"properties": {
"key": "#TESTROOT#file.txt"
}
}
]
}
],
"columnKind": "utf16CodeUnits"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "http://json.schemastore.org/sarif-1.0.0",
"version": "1.0.0",
"runs": [
{
"tool": {
"name": "CodeScanner",
"semanticVersion": "2.1.0"
},
"files": {
"file://c:/archive_one.zip#/file.txt": {
"mimeType": "text/plain",
"parentKey": "file://c:/archive_one.zip",
"uri": "/file.txt"
},
"file://c:/archive_one.zip": {
"mimeType": "application/zip"
},
"file.txt": {
"mimeType": "text/plain"
},
"file://c:/archive_one.zip#/archive_two.zip/file.txt": {
"mimeType": "text/plain",
"parentKey": "file://c:/archive_one.zip#/archive_two.zip",
"uri": "/file.txt"
},
"file://c:/archive_one.zip#/archive_two.zip": {
"mimeType": "application/zip",
"parentKey": "file://c:/archive_one.zip",
"uri": "/archive_two.zip"
}
},
"results": [
{
"ruleId": "C1",
"message": "a",
"locations": [
{
"analysisTarget": {
"uri": "file.txt"
},
"properties": {
"key": "file.txt"
}
}
]
},
{
"ruleId": "C1",
"message": "a",
"locations": [
{
"analysisTarget": {
"uri": "file://c:/archive_one.zip#/file.txt"
},
"properties": { "key": "file://c:/archive_one.zip#/file.txt" }
}
]
},
{
"ruleId": "C1",
"message": "a",
"locations": [
{
"analysisTarget": {
"uri": "file://c:/archive_one.zip#/archive_two.zip/file.txt"
},
"properties": { "key": "file://c:/archive_one.zip#/archive_two.zip/file.txt" }
}
]
}
]
}
]
}
Loading