Author: arina
Date: 2007-12-04 05:35:14 -0500 (Tue, 04 Dec 2007)
New Revision: 90629
Added:
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexReplaceTests.cs
Modified:
trunk/mcs/class/System/ChangeLog
trunk/mcs/class/System/System.Text.RegularExpressions/parser.cs
trunk/mcs/class/System/System_test.dll.sources
trunk/mcs/class/System/Test/ChangeLog
trunk/mcs/class/System/Test/System.Test20.csproj
trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexResultTests.cs
Log:
Max value of m for a construct {n,m} is 2147483647.
Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog 2007-12-04 10:29:42 UTC (rev 90628)
+++ trunk/mcs/class/System/ChangeLog 2007-12-04 10:35:14 UTC (rev 90629)
@@ -1,5 +1,9 @@
2007-12-04 Arina Itkes <[EMAIL PROTECTED]>
+ * parser.cs: Max value of m for a construct {n,m} is 2147483647.
+
+2007-12-04 Arina Itkes <[EMAIL PROTECTED]>
+
* Uri.cs: Unix absolute path should not be valid on Windows.
2007-12-04 Arina Itkes <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/System/System.Text.RegularExpressions/parser.cs
===================================================================
--- trunk/mcs/class/System/System.Text.RegularExpressions/parser.cs
2007-12-04 10:29:42 UTC (rev 90628)
+++ trunk/mcs/class/System/System.Text.RegularExpressions/parser.cs
2007-12-04 10:35:14 UTC (rev 90629)
@@ -761,8 +761,8 @@
/* check bounds and ordering */
- if (n >= 0xffff || m >= 0xffff)
- throw NewParseException ("Illegal {x, y} -
maximum of 65535.");
+ if (n > 0x7fffffff || m > 0x7fffffff)
+ throw NewParseException ("Illegal {x, y} -
maximum of 2147483647.");
if (m >= 0 && m < n)
throw NewParseException ("Illegal {x, y} with x
> y.");
@@ -772,7 +772,7 @@
if (m > 0)
max = m;
else
- max = 0xffff;
+ max = 0x7fffffff;
return true;
}
Modified: trunk/mcs/class/System/System_test.dll.sources
===================================================================
--- trunk/mcs/class/System/System_test.dll.sources 2007-12-04 10:29:42 UTC
(rev 90628)
+++ trunk/mcs/class/System/System_test.dll.sources 2007-12-04 10:35:14 UTC
(rev 90629)
@@ -268,6 +268,7 @@
System.Text.RegularExpressions/PerlTest.cs
System.Text.RegularExpressions/PerlTrials.cs
System.Text.RegularExpressions/RegexCompilationInfoTest.cs
+System.Text.RegularExpressions/RegexReplaceTests.cs
System.Text.RegularExpressions/RegexTrial.cs
System.Text.RegularExpressions/RegexTest.cs
System.Text.RegularExpressions/RegexBugs.cs
Modified: trunk/mcs/class/System/Test/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/ChangeLog 2007-12-04 10:29:42 UTC (rev
90628)
+++ trunk/mcs/class/System/Test/ChangeLog 2007-12-04 10:35:14 UTC (rev
90629)
@@ -1,5 +1,10 @@
2007-12-04 Arina Itkes <[EMAIL PROTECTED]>
+ * System_test.dll.sources : added RegexReplaceTests.cs
+ * PerlTest.cs, PerlTrials.cs, RegexResultTests.cs: New tests added.
+
+2007-12-04 Arina Itkes <[EMAIL PROTECTED]>
+
* UriTest.cs, UriTest2.cs : Tests that check Unix path should
not run on Windows.
Modified: trunk/mcs/class/System/Test/System.Test20.csproj
===================================================================
--- trunk/mcs/class/System/Test/System.Test20.csproj 2007-12-04 10:29:42 UTC
(rev 90628)
+++ trunk/mcs/class/System/Test/System.Test20.csproj 2007-12-04 10:35:14 UTC
(rev 90629)
@@ -269,6 +269,7 @@
<Compile
Include="System.Text.RegularExpressions\RegexCompilationInfoTest.cs" />
<Compile Include="System.Text.RegularExpressions\RegexMatchTests.cs" />
<Compile Include="System.Text.RegularExpressions\RegexReplace.cs" />
+ <Compile Include="System.Text.RegularExpressions\RegexReplaceTests.cs" />
<Compile Include="System.Text.RegularExpressions\RegexResultTests.cs" />
<Compile Include="System.Text.RegularExpressions\RegexRunnerFactoryCas.cs"
/>
<Compile Include="System.Text.RegularExpressions\RegexTest.cs" />
Modified: trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
2007-12-04 10:29:42 UTC (rev 90628)
+++ trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
2007-12-04 10:35:14 UTC (rev 90629)
@@ -994,5 +994,31 @@
[Test] public void Trial0962 () { PerlTrials.trials
[962].Execute (); }
[Test] public void Trial0963 () { PerlTrials.trials
[963].Execute (); }
[Test] public void Trial0964 () { PerlTrials.trials
[964].Execute (); }
+ [Test] public void Trial0965 () { PerlTrials.trials
[965].Execute (); }
+ [Test] public void Trial0966 () { PerlTrials.trials
[966].Execute (); }
+ [Test] public void Trial0967 () { PerlTrials.trials
[967].Execute (); }
+ [Test] public void Trial0968 () { PerlTrials.trials
[968].Execute (); }
+ [Test] public void Trial0969 () { PerlTrials.trials
[969].Execute (); }
+ [Test] public void Trial0970 () { PerlTrials.trials
[970].Execute (); }
+ [Test] public void Trial0971 () { PerlTrials.trials
[971].Execute (); }
+ [Test] public void Trial0972 () { PerlTrials.trials
[972].Execute (); }
+ [Test] public void Trial0973 () { PerlTrials.trials
[973].Execute (); }
+ [Test] public void Trial0974 () { PerlTrials.trials
[974].Execute (); }
+ [Test] public void Trial0975 () { PerlTrials.trials
[975].Execute (); }
+ [Test] public void Trial0976 () { PerlTrials.trials
[976].Execute (); }
+ [Test] public void Trial0977 () { PerlTrials.trials
[977].Execute (); }
+ [Test] public void Trial0978 () { PerlTrials.trials
[978].Execute (); }
+ [Test] public void Trial0979 () { PerlTrials.trials
[979].Execute (); }
+ [Test] public void Trial0980 () { PerlTrials.trials
[980].Execute (); }
+ [Test] public void Trial0981 () { PerlTrials.trials
[981].Execute (); }
+ [Test] public void Trial0982 () { PerlTrials.trials
[982].Execute (); }
+ [Test] public void Trial0983 () { PerlTrials.trials
[983].Execute (); }
+ [Test] public void Trial0984 () { PerlTrials.trials
[984].Execute (); }
+ [Test] public void Trial0985 () { PerlTrials.trials
[985].Execute (); }
+ [Test] public void Trial0986 () { PerlTrials.trials
[986].Execute (); }
+ [Test] public void Trial0987 () { PerlTrials.trials
[987].Execute (); }
+ [Test] public void Trial0988 () { PerlTrials.trials
[988].Execute (); }
+ [Test] public void Trial0989 () { PerlTrials.trials
[989].Execute (); }
+ [Test] public void Trial0990 () { PerlTrials.trials
[990].Execute (); }
}
}
Modified:
trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
2007-12-04 10:29:42 UTC (rev 90628)
+++ trunk/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
2007-12-04 10:35:14 UTC (rev 90629)
@@ -1004,7 +1004,35 @@
new RegexTrial
(@"^(((?<foo>\()[^()]*)+((?<bar-foo>\))[^()]*)+)+(?(foo)(?!))$",
RegexOptions.None, ")(","Fail."),
new RegexTrial
(@"^(((?<foo>\()[^()]*)+((?<bar-foo>\))[^()]*)+)+(?(foo)(?!))$",
RegexOptions.None, "((a((b))c)","Fail."),
- new RegexTrial (@"b", RegexOptions.RightToLeft,
"babaaa", "Pass. Group[0]=(2,1)")
- };
+ new RegexTrial (@"b", RegexOptions.RightToLeft,
"babaaa", "Pass. Group[0]=(2,1)"),
+
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
"[n]", "Pass. Group[0]=(0,3) Group[1]=(1,1)"),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
"n", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
"n[i]e", "Fail."),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
"[n", "Fail."),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
"]n]", "Fail."),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
@"\[n\]", "Fail."),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
@"[n\]", "Pass. Group[0]=(0,4) Group[1]=(1,2)"),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
@"[n\[]", "Pass. Group[0]=(0,5) Group[1]=(1,3)"),
+ new
RegexTrial(@"^((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture,
@"[[n]", "Pass. Group[0]=(0,4) Group[1]=(1,2)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[s] . [n]", "Pass. Group[0]=(0,9) Group[1]=(1,1)
Group[2]=(7,1)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[s] . n", "Pass. Group[0]=(0,7) Group[1]=(1,1)
Group[2]=(6,1)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "s.[ n ]", "Pass. Group[0]=(0,7) Group[1]=(0,1)
Group[2]=(3,3)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, " . n", "Pass. Group[0]=(0,4) Group[1]=(0,1)
Group[2]=(3,1)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "s. ", "Pass. Group[0]=(0,3) Group[1]=(0,1)
Group[2]=(2,1)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[.]. ", "Pass. Group[0]=(0,5) Group[1]=(1,1)
Group[2]=(4,1)"),
+ new
RegexTrial(@"^((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[c].[s].[n]", "Pass. Group[0]=(0,11)
Group[1]=(1,1) Group[2]=(5,1) Group[3]=(9,1)"),
+ new
RegexTrial(@"^((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, " c . s . n ", "Pass. Group[0]=(0,11)
Group[1]=(0,3) Group[2]=(5,2) Group[3]=(9,2)"),
+ new
RegexTrial(@"^((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, " . [.] . [ ]", "Pass. Group[0]=(0,12)
Group[1]=(0,1) Group[2]=(4,1) Group[3]=(10,1)"),
+ new
RegexTrial(@"^((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "c.n", "Pass. Group[0]=(0,3) Group[1]=(0,1)
Group[2]=(2,1)"),
+ new
RegexTrial(@"^((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[c] .[n]", "Pass. Group[0]=(0,8) Group[1]=(1,1)
Group[2]=(6,1)"),
+ new
RegexTrial(@"^((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "c.n.", "Fail."),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "s.c.n", "Pass. Group[0]=(0,5) Group[1]=(0,1)
Group[2]=(2,1) Group[3]=(4,1)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[s].[c].[n]", "Pass. Group[0]=(0,11)
Group[1]=(1,1) Group[2]=(5,1) Group[3]=(9,1)"),
+ new
RegexTrial(@"^((\[(?<SCHEMA>[^\]]+)\])|(?<SCHEMA>[^\.\[\]]+))\s*\.\s*((\[(?<CATALOG>[^\]]+)\])|(?<CATALOG>[^\.\[\]]+))\s*\.\s*((\[(?<NAME>[^\]]+)\])|(?<NAME>[^\.\[\]]+))$",
RegexOptions.Compiled | RegexOptions.IgnoreCase |
RegexOptions.ExplicitCapture, "[s].[c].", "Fail."),
+ new
RegexTrial(@"^((\[(?<ColName>.+)\])|(?<ColName>\S+))([
]+(?<Order>ASC|DESC))?$", RegexOptions.IgnoreCase|RegexOptions.ExplicitCapture,
"[id]]", "Pass. Group[0]=(0,5) Group[1]=(1,3) Group[2]="),
+ new RegexTrial(@"a{1,2147483647}", RegexOptions.None,
"a", "Pass. Group[0]=(0,1)")
+
+ };
}
}
Added:
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexReplaceTests.cs
===================================================================
---
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexReplaceTests.cs
2007-12-04 10:29:42 UTC (rev 90628)
+++
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexReplaceTests.cs
2007-12-04 10:35:14 UTC (rev 90629)
@@ -0,0 +1,240 @@
+using System;
+using System.Text;
+using System.Text.RegularExpressions;
+using NUnit.Framework;
+
+namespace MonoTests.System.Text.RegularExpressions
+{
+ [TestFixture]
+ public class RegexReplaceTests
+ {
+ struct testcase
+ {
+ public string original, pattern, replacement, expected;
+ public testcase (string o, string p, string r, string
e) {
+ original = o;
+ pattern = p;
+ replacement = r;
+ expected = e;
+ }
+ public void Execute () {
+ string result;
+ try {
+ result = Regex.Replace (original,
pattern, replacement);
+ }
+ catch (Exception e) {
+ result = "Error.";
+ }
+ Assert.AreEqual (expected, result, "rr#: {0} ~
s,{1},{2},",
+ original, pattern, replacement);
+ }
+ }
+
+ [Test]
+ public void ReplaceTest_001 () { new testcase (@"(?(w)a|o)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_002 () { new testcase (@"(?(w)|o)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_003 () { new testcase (@"(?(w)a)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_004 () { new testcase (@"(?(w)a|)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_005 () { new testcase (@"(?(w)?|a|o)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_006 () { new testcase (@"(?(w)||o)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_007 () { new testcase (@"(?(w)(a)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_008 () { new testcase (@"(?(w))\a|)",
@"\(\?\(\w+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_009 () { new testcase (@"(?(2)a|o)",
@"\(\?\([^\)]+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_010 () { new testcase (@"(?(|)a|o)",
@"\(\?\([^\)]+\).*\|?.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_011 () { new testcase (@"a\3b",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\(\d+)", @"\5", @"a\5b").Execute
(); }
+ [Test]
+ public void ReplaceTest_012 () { new testcase (@"\3b",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\(\d+)", @"\5", @"\5b").Execute
(); }
+ [Test]
+ public void ReplaceTest_013 () { new testcase (@"\\3b",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\(\d+)", @"\5", @"\\3b").Execute
(); }
+ [Test]
+ public void ReplaceTest_014 () { new testcase (@"\\\3b",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\(\d+)", @"\5", @"\\\5b").Execute
(); }
+ [Test]
+ public void ReplaceTest_015 () { new testcase (@"a\\\\3b",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\(\d+)", @"\5",
@"a\\\\3b").Execute (); }
+ [Test]
+ public void ReplaceTest_016 () { new testcase (@"\\\k<g>",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k<(\w+)>", @"\5",
@"\\\5").Execute (); }
+ [Test]
+ public void ReplaceTest_017 () { new testcase (@"a\\\k<g>",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k<(\w+)>", @"\5",
@"a\\\5").Execute (); }
+ [Test]
+ public void ReplaceTest_018 () { new testcase (@"\\\\k'g'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k'(\w+)'", @"\5",
@"\\\\k'g'").Execute (); }
+ [Test]
+ public void ReplaceTest_019 () { new testcase (@"a\\\\k'g'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k'(\w+)'", @"\5",
@"a\\\\k'g'").Execute (); }
+ [Test]
+ public void ReplaceTest_020 () { new testcase (@"\k'g'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k'(\w+)'", @"\5", @"\5").Execute
(); }
+ [Test]
+ public void ReplaceTest_021 () { new testcase (@"(?<n1-n2>)",
@"\(\?<[A-Za-z]\w*-[A-Za-z]\w*>.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_022 () { new testcase (@"(?'n1-n2'a)",
@"\(\?'[A-Za-z]\w*-[A-Za-z]\w*'.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_023 () { new testcase (@"\p{Isa}",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\\[pP]\{)Is(?=\w+\})", "In",
@"\p{Ina}").Execute (); }
+ [Test]
+ public void ReplaceTest_024 () { new testcase (@"\p{Is}",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\\[pP]\{)Is(?=\w+\})", "In",
@"\p{Is}").Execute (); }
+ [Test]
+ public void ReplaceTest_025 () { new testcase (@"\p{Isa",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\\[pP]\{)Is(?=\w+\})", "In",
@"\p{Isa").Execute (); }
+ [Test]
+ public void ReplaceTest_026 () { new testcase (@"a(?#|)",
@"\(\?#[^\)]*\)", "", "a").Execute (); }
+ [Test]
+ public void ReplaceTest_027 () { new testcase (@"(?#|)",
@"\(\?#[^\)]*\)", "", "").Execute (); }
+ [Test]
+ public void ReplaceTest_028 () { new testcase (@"(?#|)",
@"\#[^\n\r]*", "", "(?").Execute (); }
+ [Test]
+ public void ReplaceTest_029 () { new testcase (@"(?inm-xs:\#)",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?[imsx]*n[-imsx]*:[^\)]+\)",
"r", @"(r").Execute (); }
+ [Test]
+ public void ReplaceTest_030 () { new testcase (@"(?ni:())",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?[imsx]*n[-imsx]*:[^\)]+\)",
"r", @"(r)").Execute (); }
+ [Test]
+ public void ReplaceTest_031 () { new testcase (@"(?x-i:)",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?[imsx]*n[-imsx]*:[^\)]+\)",
"r", @"(?x-i:)").Execute (); }
+ [Test]
+ public void ReplaceTest_032 () { new testcase (@"(?n:))",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?[imsx]*n[-imsx]*:[^\)]+\)",
"r", @"(?n:))").Execute (); }
+ [Test]
+ public void ReplaceTest_033 () { new testcase (@"(?<n1>)",
@"\(\?<[A-Za-z]\w*>.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_034 () { new testcase (@"(?'n1'y)",
@"\(\?'[A-Za-z]\w*'.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_035 () { new testcase (@"(?<45>y)",
@"\(\?<\d+>.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_036 () { new testcase (@"(?'7'o)",
@"\(\?'\d+'.*\)", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_037 () { new testcase (@"\\\(",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\\(", "r", @"\\r").Execute (); }
+ [Test]
+ public void ReplaceTest_038 () { new testcase (@"a\\\(",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\\(", "r", @"a\\r").Execute (); }
+ [Test]
+ public void ReplaceTest_039 () { new testcase (@"\\(",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\\(", "r", @"\\(").Execute (); }
+ [Test]
+ public void ReplaceTest_040 () { new testcase (@"a\\(",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\\(", "r", @"a\\(").Execute (); }
+ [Test]
+ public void ReplaceTest_041 () { new testcase (@"\(",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\\(", "r", @"r").Execute (); }
+ [Test]
+ public void ReplaceTest_042 () { new testcase (@"a\(",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\\(", "r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_043 () { new testcase (@"?:",
@"(?:^\?[:imnsx=!>-]|^\?<[!=])", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_044 () { new testcase (@"?<!",
@"(?:^\?[:imnsx=!>-]|^\?<[!=])", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_045 () { new testcase (@"?-",
@"(?:^\?[:imnsx=!>-]|^\?<[!=])", "r", "r").Execute (); }
+ [Test]
+ public void ReplaceTest_046 () { new testcase (@"\\(?<n>",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?<[A-Za-z]\w*>", "r",
@"\\(r").Execute (); }
+ [Test]
+ public void ReplaceTest_047 () { new testcase (@"a\\(?'n'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?'[A-Za-z]\w*'", "r",
@"a\\(r").Execute (); }
+ [Test]
+ public void ReplaceTest_048 () { new testcase (@"\\\\(?<2>",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?<\d+>", "r", @"\\\\(r").Execute
(); }
+ [Test]
+ public void ReplaceTest_049 () { new testcase (@"(?'2'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823}\()\?'\d+'", "r", "(r").Execute (); }
+ [Test]
+ public void ReplaceTest_050 () { new testcase (@"\\[\b]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\\b(?=[^\[\]]*\])",
@"\\u0008", @"\\[\\u0008]").Execute (); }
+ [Test]
+ public void ReplaceTest_051 () { new testcase (@"\\[a\bb]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\\b(?=[^\[\]]*\])",
@"\\u0008", @"\\[a\\u0008b]").Execute (); }
+ [Test]
+ public void ReplaceTest_052 () { new testcase (@"\[\b]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\\b(?=[^\[\]]*\])",
@"\\u0008", @"\[\b]").Execute (); }
+ [Test]
+ public void ReplaceTest_053 () { new testcase (@"\\[\\b]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\\b(?=[^\[\]]*\])",
@"\\u0008", @"\\[\\b]").Execute (); }
+ [Test]
+ public void ReplaceTest_054 () { new testcase (@"\\[\\\b]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\\b(?=[^\[\]]*\])",
@"\\u0008", @"\\[\\\\u0008]").Execute (); }
+ [Test]
+ public void ReplaceTest_055 () { new testcase (@"[[]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\[(?=[^\[\]]*\])",
@"\\[", @"[\\[]").Execute (); }
+ [Test]
+ public void ReplaceTest_056 () { new testcase (@"\[[]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\[(?=[^\[\]]*\])",
@"\\[", @"\[[]").Execute (); }
+ [Test]
+ public void ReplaceTest_057 () { new testcase (@"\\[\\[]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\[(?=[^\[\]]*\])",
@"\\[", @"\\[\\\\[]").Execute (); }
+ [Test]
+ public void ReplaceTest_058 () { new testcase (@"\\[\\\[]",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*(?:\[|\[[^\[\]]*[^\[\]\\])(?:[\\]{2})*)\[(?=[^\[\]]*\])",
@"\\[", @"\\[\\\[]").Execute (); }
+ [Test]
+ public void ReplaceTest_059 () { new testcase (@"\\{",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\{(?!\d\d*(,(\d\d*)?)?\})", @"\\{",
@"\\\\{").Execute (); }
+ [Test]
+ public void ReplaceTest_060 () { new testcase (@"\\{",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\{(?!\d\d*(,(\d\d*)?)?\})", @"\\{",
@"\\\\{").Execute (); }
+ [Test]
+ public void ReplaceTest_061 () { new testcase (@"\\{1,2}",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\{(?!\d\d*(,(\d\d*)?)?\})", @"\\{",
@"\\{1,2}").Execute (); }
+ [Test]
+ public void ReplaceTest_062 () { new testcase (@"\\{1}",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\{(?!\d\d*(,(\d\d*)?)?\})", @"\\{",
@"\\{1}").Execute (); }
+ [Test]
+ public void ReplaceTest_063 () { new testcase (@"\\{1,}",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\{(?!\d\d*(,(\d\d*)?)?\})", @"\\{",
@"\\{1,}").Execute (); }
+ [Test]
+ public void ReplaceTest_064 () { new testcase (@"\{1",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\{(?!\d\d*(,(\d\d*)?)?\})", @"\\{",
@"\{1").Execute (); }
+ [Test]
+ public void ReplaceTest_065 () { new testcase (@"\\}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"\\\\}").Execute (); }
+ [Test]
+ public void ReplaceTest_066 () { new testcase (@"{\\}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"{\\\\}").Execute ();
}
+ [Test]
+ public void ReplaceTest_067 () { new testcase (@"{1,2}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"{1,2}").Execute (); }
+ [Test]
+ public void ReplaceTest_068 () { new testcase (@"\\{1}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"\\{1}").Execute (); }
+ [Test]
+ public void ReplaceTest_069 () { new testcase (@"\\{1\}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"\\{1\\\}").Execute
(); }
+ [Test]
+ public void ReplaceTest_070 () { new testcase (@"\{1}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"\{1\\}").Execute ();
}
+ [Test]
+ public void ReplaceTest_071 () { new testcase (@"{1,}",
@"(?<!(\A|[^\\])(\\{2})*\{\d\d*(,(\d\d*)?)?)\}", @"\\}", @"{1,}").Execute (); }
+ [Test]
+ public void ReplaceTest_072 () { new testcase (@"\0",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\\0(?!\d)", @"\\u0000", @"\\u0000").Execute (); }
+ [Test]
+ public void ReplaceTest_073 () { new testcase (@"\03",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\\0(?!\d)", @"\\u0000", @"\03").Execute (); }
+ [Test]
+ public void ReplaceTest_074 () { new testcase (@"\\0",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\\0(?!\d)", @"\\u0000", @"\\0").Execute (); }
+ [Test]
+ public void ReplaceTest_075 () { new testcase (@"\\\0a",
@"(?<=(?:\A|[^\\])(?:[\\]{2})*)\\0(?!\d)", @"\\u0000", @"\\\\u0000a").Execute
(); }
+ [Test]
+ public void ReplaceTest_076 () { new testcase (@"a(?<=b*c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_077 () { new testcase (@"a(?<=b*c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_078 () { new testcase (@"a(?<=b*c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_079 () { new testcase (@"a(?<=b+c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_080 () { new testcase (@"a(?<!b+c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_081 () { new testcase (@"a(?<!b*c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"ar").Execute (); }
+ [Test]
+ public void ReplaceTest_082 () { new testcase (@"(?<!b{1}c))",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"(?<!b{1}c))").Execute (); }
+ [Test]
+ public void ReplaceTest_083 () { new testcase (@"(?<!b{1,}c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"r").Execute (); }
+ [Test]
+ public void ReplaceTest_084 () { new testcase (@"(?<!b{1,4}c)",
@"\(\?\<[=!][^\)]*(?:[\*\+]|\{\d+,\}).*\)", @"r", @"(?<!b{1,4}c)").Execute (); }
+ [Test]
+ public void ReplaceTest_085 () { new testcase (@"\p{Isa}",
@"(?<=\\[pP]\{)Is(?=\w+\})", "In", @"\p{Ina}").Execute (); }
+ [Test]
+ public void ReplaceTest_086 () { new testcase (@"\p{Is}",
@"(?<=\\[pP]\{)Is(?=\w+\})", "In", @"\p{Is}").Execute (); }
+ [Test]
+ public void ReplaceTest_087 () { new testcase (@"\p{Isa",
@"(?<=\\[pP]\{)Is(?=\w+\})", "In", @"\p{Isa").Execute (); }
+ [Test]
+ public void ReplaceTest_088 () { new testcase (@"a\3b",
@"\\(\d+)", @"\5", @"a\5b").Execute (); }
+ [Test]
+ public void ReplaceTest_089 () { new testcase (@"\3b",
@"\\(\d+)", @"\5", @"\5b").Execute (); }
+ [Test]
+ public void ReplaceTest_090 () { new testcase (@"\\3b",
@"(?<=\\)\\(\d)", @"\5", @"\\5b").Execute (); }
+ [Test]
+ public void ReplaceTest_091 () { new testcase (@"\\\3b",
@"(?<=\\\\)\\(\d)", @"\5", @"\\\5b").Execute (); }
+ [Test]
+ public void ReplaceTest_092 () { new testcase (@"a\\\\3b",
@"(?<=(\\){0,5})\\(\d)", @"\5", @"a\\\\5b").Execute (); }
+ [Test]
+ public void ReplaceTest_093 () { new testcase (@"\\\k<g>",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k<(\w)>", @"\5", @"\\\5").Execute
(); }
+ [Test]
+ public void ReplaceTest_094 () { new testcase (@"a\\\k<g>",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k<(\w)>", @"\5",
@"a\\\5").Execute (); }
+ [Test]
+ public void ReplaceTest_095 () { new testcase (@"\\\\k'g'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k'(\w)'", @"\5",
@"\\\\k'g'").Execute (); }
+ [Test]
+ public void ReplaceTest_096 () { new testcase (@"a\\\\k'g'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k'(\w)'", @"\5",
@"a\\\\k'g'").Execute (); }
+ [Test]
+ public void ReplaceTest_097 () { new testcase (@"\k'g'",
@"(?<=(?:\A|[^\\])(?:[\\]{2}){0,1073741823})\\k'(\w)'", @"\5", @"\5").Execute
(); }
+ [Test]
+ public void ReplaceTest_098 () { new testcase (@"\\(?<={1}",
@"(\A|((\A|[^\\])([\\]{2})*\((\?([:>=!]|<([=!]|(\w+>))))?))\{\d+(,(\d+)?)?\}",
@"\5", @"\5").Execute (); }
+ [Test]
+ public void ReplaceTest_099 () { new testcase (@"{1}",
@"(\A|((\A|[^\\])([\\]{2})*\((\?([:>=!]|<([=!]|(\w+>))))?))\{\d+(,(\d+)?)?\}",
@"r", @"r").Execute (); }
+ [Test]
+ public void ReplaceTest_100 () { new testcase (@"({1}",
@"(\A|((\A|[^\\])([\\]{2})*\((\?([:>=!]|<([=!]|(\w+>))))?))\{\d+(,(\d+)?)?\}",
@"r", @"r").Execute (); }
+ [Test]
+ public void ReplaceTest_101 () { new testcase (@"(?{1}",
@"(\A|((\A|[^\\])([\\]{2})*\((\?([:>=!]|<([=!]|(\w+>))))?))\{\d+(,(\d+)?)?\}",
@"r", @"(?{1}").Execute (); }
+ [Test]
+ public void ReplaceTest_102 () { new testcase (@"(?:{1}",
@"(\A|((\A|[^\\])([\\]{2})*\((\?([:>=!]|<([=!]|(\w+>))))?))\{\d+(,(\d+)?)?\}",
@"r", @"r").Execute (); }
+ [Test]
+ public void ReplaceTest_103 () { new testcase (@"\({1}",
@"(\A|((\A|[^\\])([\\]{2})*\((\?([:>=!]|<([=!]|(\w+>))))?))\{\d+(,(\d+)?)?\}",
@"r", @"\({1}").Execute (); }
+ }
+}
Modified:
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexResultTests.cs
===================================================================
---
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexResultTests.cs
2007-12-04 10:29:42 UTC (rev 90628)
+++
trunk/mcs/class/System/Test/System.Text.RegularExpressions/RegexResultTests.cs
2007-12-04 10:35:14 UTC (rev 90629)
@@ -79,6 +79,7 @@
new testcase ("2 314 1592 65358",
@"\d\d\d\d|\d\d\d", "a", "a" ),//42
new testcase ("<i>am not</i>", "<(.+?)>",
"[$0:$1]", "[<i>:i]"),//43
new testcase ("F2345678910L71",
@"(F)(2)(3)(4)(5)(6)(?<S>7)(8)(9)(10)(L)\11", "${S}$11$1", "77F" ),//44
+ new testcase ("a", "a", @"\\", @"\\"), // bug #317092
//45
};
[Test]
@@ -172,5 +173,7 @@
[Test]
[Category("NotWorking")]
public void ResultTest_044 () { tests [44].Execute (); }
+ [Test]
+ public void ResultTest_045 () { tests [45].Execute (); }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches