Skip to content

Commit

Permalink
Hopefully fix tests for .NET Framework, add few more test cases that …
Browse files Browse the repository at this point in the history
…should fail
  • Loading branch information
N0D4N committed Sep 21, 2021
1 parent 28a420c commit 6dab515
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public override Version Read(ref Utf8JsonReader reader, Type typeToConvert, Json
}
#else
string? versionString = reader.GetString();
if (versionString != null && !char.IsDigit(versionString[0]) && !char.IsDigit(versionString[versionString.Length - 1]))
if (!string.IsNullOrEmpty(versionString) && !char.IsDigit(versionString[0]) && !char.IsDigit(versionString[versionString.Length - 1]))
{
throw ThrowHelper.GetFormatException(DataType.Version);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ public static void Version_Read_Success(string json, string? actual = null)

[Theory]
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
[InlineData("2147483648.2147483648.2147483648.2147483648")] //int.MaxValue + 1
[InlineData("2147483647.2147483647.2147483647.21474836477")] // Slightly bigger in size than max length of Version
[InlineData("-2147483648.-2147483648")]
[InlineData("-2147483648.-2147483648.-2147483648")]
[InlineData("-2147483648.-2147483648.-2147483648.-2147483648")]
Expand Down

0 comments on commit 6dab515

Please sign in to comment.