2
0
Эх сурвалжийг харах

2004-05-27 Gonzalo Paniagua Javier <[email protected]>

	* RegexBugs.cs: added tests from bug #59150.

svn path=/trunk/mcs/; revision=28216
Gonzalo Paniagua Javier 21 жил өмнө
parent
commit
6e6ffcb1a2

+ 4 - 0
mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog

@@ -1,3 +1,7 @@
+2004-05-27  Gonzalo Paniagua Javier <[email protected]>
+
+	* RegexBugs.cs: added tests from bug #59150.
+
 2004-04-19  Gonzalo Paniagua Javier <[email protected]>
 
 	* Test/System.Text.RegularExpressions/PerlTrials.cs:

+ 41 - 1
mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs

@@ -4,7 +4,7 @@
 // Authors:
 // 	Gonzalo Paniagua Javier ([email protected])
 //
-// (c) 2003 Novell, Inc. (http://www.novell.com)
+// (c) Copyright 2003,2004 Novell, Inc. (http://www.novell.com)
 //
 
 using NUnit.Framework;
@@ -153,6 +153,46 @@ namespace MonoTests.System.Text.RegularExpressions
 			AssertNotNull ("#5", g.Captures);
 			AssertEquals ("#6", 0, g.Captures.Count);
 		}
+
+		[Test]
+		public void Quantifiers1 ()
+		{
+			Regex re = new Regex ("[\\w\\W]{8,32}");
+			Match m = re.Match (new string ('1', 7));
+			AssertEquals ("#01", false, m.Success);
+		}
+
+		[Test]
+		public void Quantifiers2 ()
+		{
+			Regex re = new Regex ("[\\w\\W]{8,32}");
+			Match m = re.Match (new string ('1', 8));
+			AssertEquals ("#01", true, m.Success);
+		}
+
+		[Test]
+		public void Quantifiers3 ()
+		{
+			Regex re = new Regex ("[\\w\\W]{8,32}");
+			Match m = re.Match (new string ('1', 16));
+			AssertEquals ("#01", true, m.Success);
+		}
+
+		[Test]
+		public void Quantifiers4 ()
+		{
+			Regex re = new Regex ("[\\w\\W]{8,32}");
+			Match m = re.Match (new string ('1', 32));
+			AssertEquals ("#01", true, m.Success);
+		}
+
+		[Test]
+		public void Quantifiers5 ()
+		{
+			Regex re = new Regex ("[\\w\\W]{8,32}");
+			Match m = re.Match (new string ('1', 33));
+			AssertEquals ("#01", true, m.Success);
+		}
 	}
 }