Skip to content

Commit

Permalink
Fix BigInteger outerloop test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley committed Jan 27, 2022
1 parent cfd15d5 commit 9df2832
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ internal static bool TryValidateParseStyleInteger(NumberStyles style, [NotNullWh
{ // Check for hex number
if ((style & ~NumberStyles.HexNumber) != 0)
{
e = new ArgumentException(SR.Argument_InvalidHexStyle);
e = new ArgumentException(SR.Argument_InvalidHexStyle, nameof(style));
return false;
}
}
Expand Down
16 changes: 13 additions & 3 deletions src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class parseTest

// Invariant culture is commonly used for (de-)serialization and similar to en-US
// Ukrainian (Ukraine) added to catch regressions (https://github.com/dotnet/runtime/issues/14545)
// Current cultue to get additional value out of glob/loc test runs
// Current culture to get additional value out of glob/loc test runs
public static IEnumerable<object[]> Cultures
{
get
Expand Down Expand Up @@ -66,11 +66,11 @@ public static void RunParseToStringTests(CultureInfo culture)
//invalid number style
// ******InvalidNumberStyles
NumberStyles invalid = (NumberStyles)0x7c00;
AssertExtensions.Throws<ArgumentException>(null, () =>
AssertExtensions.Throws<ArgumentException>("style", () =>
{
BigInteger.Parse("1", invalid).ToString("d");
});
AssertExtensions.Throws<ArgumentException>(null, () =>
AssertExtensions.Throws<ArgumentException>("style", () =>
{
BigInteger junk;
BigInteger.TryParse("1", invalid, null, out junk);
Expand Down Expand Up @@ -116,6 +116,16 @@ public void Parse_Hex32Bits()

Assert.True(BigInteger.TryParse("080000001", NumberStyles.HexNumber, null, out result));
Assert.Equal(0x80000001u, result);

Assert.Throws<FormatException>(() =>
{
BigInteger.Parse("zzz", NumberStyles.HexNumber);
});

AssertExtensions.Throws<ArgumentException>("style", () =>
{
BigInteger.Parse("1", NumberStyles.AllowHexSpecifier | NumberStyles.AllowCurrencySymbol);
});
}

private static void RunFormatProviderParseStrings()
Expand Down

0 comments on commit 9df2832

Please sign in to comment.