Skip to content

Commit

Permalink
Fix regex outerloop tests (#70246)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Jun 5, 2022
1 parent bad2ab0 commit e70ffaa
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,15 @@ public async Task Match_VaryingLengthStrings(RegexEngine engine, RegexOptions op
[MemberData(nameof(RegexHelpers.AvailableEngines_MemberData), MemberType = typeof(RegexHelpers))]
public async Task Match_VaryingLengthStrings_Huge(RegexEngine engine)
{
await Match_VaryingLengthStrings(engine, RegexOptions.None, 100_000);
RegexHelpers.SetSafeSizeThreshold(100_002);
try
{
await Match_VaryingLengthStrings(engine, RegexOptions.None, 100_000);
}
finally
{
RegexHelpers.RestoreSafeSizeThresholdToDefault();
}
}

public static IEnumerable<object[]> Match_DeepNesting_MemberData()
Expand Down Expand Up @@ -1923,7 +1931,7 @@ public async Task StressTestDeepNestingOfConcat(RegexEngine engine, string patte
string fullpattern = string.Concat(string.Concat(Enumerable.Repeat($"({pattern}", pattern_repetition).Concat(Enumerable.Repeat(")", pattern_repetition))), anchor);
string fullinput = string.Concat(Enumerable.Repeat(input, input_repetition));

RegexHelpers.SetSafeSizeThreshold(10_000);
RegexHelpers.SetSafeSizeThreshold(10_005);
Regex re;
try
{
Expand Down Expand Up @@ -1955,7 +1963,7 @@ public async Task StressTestDeepNestingOfLoops(RegexEngine engine, string begin,
string fullpattern = string.Concat(Enumerable.Repeat(begin, pattern_repetition)) + inner + string.Concat(Enumerable.Repeat(end, pattern_repetition));
string fullinput = string.Concat(Enumerable.Repeat(input, input_repetition));

RegexHelpers.SetSafeSizeThreshold(10_000);
RegexHelpers.SetSafeSizeThreshold(int.MaxValue);
Regex re;
try
{
Expand Down

0 comments on commit e70ffaa

Please sign in to comment.