diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 2bcc0bf4b467c..e839f6fcf8131 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -1011,20 +1011,20 @@ public void Match_DefaultTimeout_Throws(RegexOptions options) if ((RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture) == RegexOptions.None) { Assert.Throws(() => new Regex(Pattern).Match(input)); - VerifyIsMatchThrows(new Regex(Pattern), input, Regex.InfiniteMatchTimeout); + Assert.Throws(() => new Regex(Pattern).IsMatch(input)); Assert.Throws(() => new Regex(Pattern).Matches(input).Count); Assert.Throws(() => Regex.Match(input, Pattern)); - VerifyIsMatchThrows(null, input, Regex.InfiniteMatchTimeout, Pattern); + Assert.Throws(() => Regex.IsMatch(input, Pattern)); Assert.Throws(() => Regex.Matches(input, Pattern).Count); } Assert.Throws(() => new Regex(Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture)).Match(input)); - VerifyIsMatchThrows(new Regex(Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture)), input, Regex.InfiniteMatchTimeout); + Assert.Throws(() => new Regex(Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture)).IsMatch(input)); Assert.Throws(() => new Regex(Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture)).Matches(input).Count); Assert.Throws(() => Regex.Match(input, Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture))); - VerifyIsMatchThrows(null, input, Regex.InfiniteMatchTimeout, Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture)); + Assert.Throws(() => Regex.IsMatch(input, Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture))); Assert.Throws(() => Regex.Matches(input, Pattern, (RegexOptions)int.Parse(optionsString, CultureInfo.InvariantCulture)).Count); }, ((int)options).ToString(CultureInfo.InvariantCulture)).Dispose(); } diff --git a/src/libraries/System.Text.RegularExpressions/tests/RegexRunnerTests.cs b/src/libraries/System.Text.RegularExpressions/tests/RegexRunnerTests.cs index 46343cc55de56..82f2ae5a0336b 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/RegexRunnerTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/RegexRunnerTests.cs @@ -10,10 +10,7 @@ namespace System.Text.RegularExpressions.Tests public class RegexRunnerTests { [Theory] - [InlineData(RegexEngine.Interpreter)] - [InlineData(RegexEngine.Compiled)] - [InlineData(RegexEngine.SourceGenerated)] - [InlineData(RegexEngine.NonBacktracking)] + [MemberData(nameof(RegexHelpers.AvailableEngines_MemberData), MemberType = typeof(RegexHelpers))] public async Task EnginesThrowNotImplementedForGoAndFFC(RegexEngine engine) { Regex re = await RegexHelpers.GetRegexAsync(engine, /*lang=regex*/@"abc"); @@ -34,10 +31,7 @@ public async Task EnginesThrowNotImplementedForGoAndFFC(RegexEngine engine) } [Theory] - [InlineData(RegexEngine.Interpreter)] - [InlineData(RegexEngine.Compiled)] - [InlineData(RegexEngine.SourceGenerated)] - [InlineData(RegexEngine.NonBacktracking)] + [MemberData(nameof(RegexHelpers.AvailableEngines_MemberData), MemberType = typeof(RegexHelpers))] public async Task EnsureRunmatchValueIsNulledAfterIsMatch(RegexEngine engine) { Regex re = await RegexHelpers.GetRegexAsync(engine, /*lang=regex*/@"abc"); @@ -53,8 +47,8 @@ public async Task EnsureRunmatchValueIsNulledAfterIsMatch(RegexEngine engine) Assert.NotNull(runmatch); // Ensure that the Value of runmatch was nulled out, so as to not keep a reference to it in a cache. - PropertyInfo textProperty = typeof(Match).GetProperty("Text", BindingFlags.Instance | BindingFlags.NonPublic); - Assert.Null(textProperty.GetValue(runmatch)); + MethodInfo getTextMethod = typeof(Match).GetMethod("get_Text", BindingFlags.Instance | BindingFlags.NonPublic); + Assert.Null(getTextMethod.Invoke(runmatch, new object[] { })); Assert.Equal(string.Empty, runmatch.Value); #if NET7_0_OR_GREATER Assert.True(runmatch.ValueSpan == ReadOnlySpan.Empty); diff --git a/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj b/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj index d382adaad11c6..951257ab4b5b6 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj +++ b/src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj @@ -11,7 +11,6 @@ - @@ -33,7 +32,6 @@ - @@ -43,6 +41,8 @@ + +