Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: tests/corelib/regexp/ranges-and-escaped-hyphens_test.dart

Issue 2850783002: Dart SDK Spelling b, c, and d. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. All rights reserved. 1 // Copyright (c) 2014, the Dart project authors. All rights reserved.
2 // Copyright 2013 the V8 project authors. All rights reserved. 2 // Copyright 2013 the V8 project authors. All rights reserved.
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions 6 // modification, are permitted provided that the following conditions
7 // are met: 7 // are met:
8 // 1. Redistributions of source code must retain the above copyright 8 // 1. Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // 2. Redistributions in binary form must reproduce the above copyright 10 // 2. Redistributions in binary form must reproduce the above copyright
(...skipping 29 matching lines...) Expand all
40 // These are invalid ranges, according to ECMA-262, but we allow them. 40 // These are invalid ranges, according to ECMA-262, but we allow them.
41 var regexp01b = new RegExp(r"[1\s-35]+").firstMatch("21-3 54"); 41 var regexp01b = new RegExp(r"[1\s-35]+").firstMatch("21-3 54");
42 shouldBe(regexp01b, ["1-3 5"]); 42 shouldBe(regexp01b, ["1-3 5"]);
43 var regexp01c = new RegExp(r"[1-\s35]+").firstMatch("21-3 54"); 43 var regexp01c = new RegExp(r"[1-\s35]+").firstMatch("21-3 54");
44 shouldBe(regexp01c, ["1-3 5"]); 44 shouldBe(regexp01c, ["1-3 5"]);
45 45
46 var regexp01d = new RegExp(r"[1-3\s5]+").firstMatch("-123 54"); 46 var regexp01d = new RegExp(r"[1-3\s5]+").firstMatch("-123 54");
47 shouldBe(regexp01d, ["123 5"]); 47 shouldBe(regexp01d, ["123 5"]);
48 var regexp01e = new RegExp(r"[1-35\s5]+").firstMatch("-123 54"); 48 var regexp01e = new RegExp(r"[1-35\s5]+").firstMatch("-123 54");
49 shouldBe(regexp01e, ["123 5"]); 49 shouldBe(regexp01e, ["123 5"]);
50 // hyphens are normal charaters if a range is not fully specified. 50 // hyphens are normal characters if a range is not fully specified.
51 var regexp01f = new RegExp(r"[-3]+").firstMatch("2-34"); 51 var regexp01f = new RegExp(r"[-3]+").firstMatch("2-34");
52 shouldBe(regexp01f, ["-3"]); 52 shouldBe(regexp01f, ["-3"]);
53 var regexp01g = new RegExp(r"[2-]+").firstMatch("12-3"); 53 var regexp01g = new RegExp(r"[2-]+").firstMatch("12-3");
54 shouldBe(regexp01g, ["2-"]); 54 shouldBe(regexp01g, ["2-"]);
55 55
56 // Similar to the above tests, but where the hyphen is escaped this is never a range. 56 // Similar to the above tests, but where the hyphen is escaped this is never a range.
57 var regexp02 = new RegExp(r"[1\-35]+").firstMatch("21-354"); 57 var regexp02 = new RegExp(r"[1\-35]+").firstMatch("21-354");
58 shouldBe(regexp02, ["1-35"]); 58 shouldBe(regexp02, ["1-35"]);
59 // As above. 59 // As above.
60 var regexp02a = new RegExp(r"[\s1\-35]+").firstMatch("21-3 54"); 60 var regexp02a = new RegExp(r"[\s1\-35]+").firstMatch("21-3 54");
(...skipping 11 matching lines...) Expand all
72 var regexp03a = new RegExp(r"[\--0]+").firstMatch(",-.01"); 72 var regexp03a = new RegExp(r"[\--0]+").firstMatch(",-.01");
73 shouldBe(regexp03a, ["-.0"]); 73 shouldBe(regexp03a, ["-.0"]);
74 var regexp03b = new RegExp(r"[+-\-]+").firstMatch("*+,-."); 74 var regexp03b = new RegExp(r"[+-\-]+").firstMatch("*+,-.");
75 shouldBe(regexp03b, ["+,-"]); 75 shouldBe(regexp03b, ["+,-"]);
76 76
77 // The actual bug reported. 77 // The actual bug reported.
78 var bug21232 = 78 var bug21232 =
79 (new RegExp(r"^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$")).hasMatch('@'); 79 (new RegExp(r"^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$")).hasMatch('@');
80 shouldBeFalse(bug21232); 80 shouldBeFalse(bug21232);
81 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698