-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix #1673 (property bag testing); Fix #1687 (NuGet packaging warning) #1688
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
458d8bf
Demonstrate property bag round-tripping.
ee9b484
Fix packaging warning; update release history and package version num…
2c8e93c
Verify null property and more arrays.
7620746
Exhaustively test deserialized values.
d4c7ed3
Add a comment.
98cf7eb
Remove unnecessary null test.
9c4e43f
Add a comment.
f051120
Remove what I now think is an unnecessary comment.
8110b4e
Show that Scott's test works with the necessary serializer settings.
9779734
Address PR feedback.
2cc8318
Add test for floating point property.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT | ||
// license. See LICENSE file in the project root for full license information. | ||
|
||
using FluentAssertions; | ||
using Newtonsoft.Json; | ||
using Xunit; | ||
|
||
namespace Microsoft.CodeAnalysis.Sarif | ||
{ | ||
public class RoundTrippingTests | ||
{ | ||
private static ResourceExtractor s_extractor = new ResourceExtractor(typeof(RoundTrippingTests)); | ||
|
||
private static string GetResourceContents(string resourceName) | ||
=> s_extractor.GetResourceText($"RoundTripping.{resourceName}"); | ||
|
||
[Fact] | ||
public void SarifLog_CanBeRoundTripped() | ||
{ | ||
string originalContents = GetResourceContents("RoundTripping.sarif"); | ||
|
||
SarifLog log = JsonConvert.DeserializeObject<SarifLog>(originalContents); | ||
|
||
string roundTrippedContents = JsonConvert.SerializeObject(log, Formatting.Indented); | ||
|
||
roundTrippedContents.Should().Be(originalContents); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Test.UnitTests.Sarif/TestData/RoundTripping/RoundTripping.sarif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.4.json", | ||
"version": "2.1.0", | ||
"runs": [ | ||
{ | ||
"tool": { | ||
"driver": { | ||
"name": "Bug1673Tester" | ||
} | ||
}, | ||
"results": [ | ||
{ | ||
"ruleId": "TST0001", | ||
"message": { | ||
"text": "Hello." | ||
}, | ||
"properties": { | ||
"date": "2019-09-25T15:07Z", | ||
"string": "Hello, string!", | ||
"integer": 42, | ||
"bigInteger": 5000000000, | ||
"true": true, | ||
"false": false, | ||
"dateArray": [ | ||
"2019-09-26T15:52Z", | ||
"2019-09-26T15:54Z" | ||
], | ||
"stringArray": [ | ||
"Thing One", | ||
"Thing Two" | ||
], | ||
"customObject": { | ||
"date": "1776-07-04T12:00Z", | ||
"string": "The 4th" | ||
} | ||
} | ||
} | ||
], | ||
"columnKind": "utf16CodeUnits" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
<Copyright Condition=" '$(Copyright)' == '' ">© Microsoft Corporation. All rights reserved.</Copyright> | ||
|
||
<!-- VersionPrefix denotes the current Semantic Version for the SDK. Must be updated before every nuget drop. --> | ||
<VersionPrefix>2.1.17</VersionPrefix> | ||
<VersionPrefix>2.1.18</VersionPrefix> | ||
|
||
<!-- SchemaVersionAsPublishedToSchemaStoreOrg identifies the current published version on json schema store at https://schemastore.azurewebsites.net/schemas/json/ --> | ||
<SchemaVersionAsPublishedToSchemaStoreOrg>2.1.0-rtm.4</SchemaVersionAsPublishedToSchemaStoreOrg> | ||
|
@@ -30,7 +30,7 @@ | |
place. These properties are actually used by the PowerShell script that | ||
hides the previous package versions on nuget.org. | ||
--> | ||
<PreviousVersionPrefix>2.1.16</PreviousVersionPrefix> | ||
<PreviousVersionPrefix>2.1.17</PreviousVersionPrefix> | ||
<PreviousSchemaVersionAsPublishedToSchemaStoreOrg>2.1.0-rtm.3</PreviousSchemaVersionAsPublishedToSchemaStoreOrg> | ||
<PreviousStableSarifVersion>2.1.0</PreviousStableSarifVersion> | ||
</PropertyGroup> | ||
|
@@ -92,14 +92,18 @@ | |
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageProjectUrl>https://github.com/Microsoft/sarif-sdk</PackageProjectUrl> | ||
<PackageIconUrl>https://go.microsoft.com/fwlink/?linkid=2008860</PackageIconUrl> | ||
<PackageIcon>triskelion.png</PackageIcon> | ||
<!-- | ||
Don't complain about SemVer 2.0.0-compatible version strings. | ||
See https://github.com/NuGet/Home/issues/4687#issuecomment-393302779. | ||
--> | ||
<NoWarn>NU5105</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\triskelion.png" Pack="true" PackagePath="\"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This fixes the warning |
||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="$(MsBuildThisFileDirectory)Shared\CommonAssemblyInfo.cs" /> | ||
</ItemGroup> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how
Formatting.Indented
renders the arrays and sub-objects withinproperties
. I don't know why. #ByDesignThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's because the
PropertyBagConverter
has taken over the serialization at this point and it doesn't retain the indentation.In reply to: 328869713 [](ancestors = 328869713)