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

Side by Side Diff: tests/corelib/regexp/multiline_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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 2008 the V8 project authors. All rights reserved. 2 // Copyright 2008 the V8 project authors. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following 10 // copyright notice, this list of conditions and the following
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 assertFalse(new RegExp(r"^bxr", multiLine: true).hasMatch("bar")); 54 assertFalse(new RegExp(r"^bxr", multiLine: true).hasMatch("bar"));
55 assertFalse(new RegExp(r"^bxr", multiLine: true).hasMatch("bar\nfoo")); 55 assertFalse(new RegExp(r"^bxr", multiLine: true).hasMatch("bar\nfoo"));
56 assertFalse(new RegExp(r"^bxr", multiLine: true).hasMatch("foo\nbar")); 56 assertFalse(new RegExp(r"^bxr", multiLine: true).hasMatch("foo\nbar"));
57 57
58 assertFalse(new RegExp(r"bxr$").hasMatch("bar")); 58 assertFalse(new RegExp(r"bxr$").hasMatch("bar"));
59 assertFalse(new RegExp(r"bxr$").hasMatch("foo\nbar")); 59 assertFalse(new RegExp(r"bxr$").hasMatch("foo\nbar"));
60 assertFalse(new RegExp(r"bxr$", multiLine: true).hasMatch("bar")); 60 assertFalse(new RegExp(r"bxr$", multiLine: true).hasMatch("bar"));
61 assertFalse(new RegExp(r"bxr$", multiLine: true).hasMatch("bar\nfoo")); 61 assertFalse(new RegExp(r"bxr$", multiLine: true).hasMatch("bar\nfoo"));
62 assertFalse(new RegExp(r"bxr$", multiLine: true).hasMatch("foo\nbar")); 62 assertFalse(new RegExp(r"bxr$", multiLine: true).hasMatch("foo\nbar"));
63 63
64
65 assertTrue(new RegExp(r"^.*$").hasMatch("")); 64 assertTrue(new RegExp(r"^.*$").hasMatch(""));
66 assertTrue(new RegExp(r"^.*$").hasMatch("foo")); 65 assertTrue(new RegExp(r"^.*$").hasMatch("foo"));
67 assertFalse(new RegExp(r"^.*$").hasMatch("\n")); 66 assertFalse(new RegExp(r"^.*$").hasMatch("\n"));
68 assertTrue(new RegExp(r"^.*$", multiLine: true).hasMatch("\n")); 67 assertTrue(new RegExp(r"^.*$", multiLine: true).hasMatch("\n"));
69 68
70 assertTrue(new RegExp(r"^[\s]*$").hasMatch(" ")); 69 assertTrue(new RegExp(r"^[\s]*$").hasMatch(" "));
71 assertTrue(new RegExp(r"^[\s]*$").hasMatch("\n")); 70 assertTrue(new RegExp(r"^[\s]*$").hasMatch("\n"));
72 71
73 assertTrue(new RegExp(r"^[^]*$").hasMatch("")); 72 assertTrue(new RegExp(r"^[^]*$").hasMatch(""));
74 assertTrue(new RegExp(r"^[^]*$").hasMatch("foo")); 73 assertTrue(new RegExp(r"^[^]*$").hasMatch("foo"));
75 assertTrue(new RegExp(r"^[^]*$").hasMatch("\n")); 74 assertTrue(new RegExp(r"^[^]*$").hasMatch("\n"));
76 75
77 assertTrue(new RegExp(r"^([()\s]|.)*$").hasMatch("()\n()")); 76 assertTrue(new RegExp(r"^([()\s]|.)*$").hasMatch("()\n()"));
78 assertTrue(new RegExp(r"^([()\n]|.)*$").hasMatch("()\n()")); 77 assertTrue(new RegExp(r"^([()\n]|.)*$").hasMatch("()\n()"));
79 assertFalse(new RegExp(r"^([()]|.)*$").hasMatch("()\n()")); 78 assertFalse(new RegExp(r"^([()]|.)*$").hasMatch("()\n()"));
80 assertTrue(new RegExp(r"^([()]|.)*$", multiLine: true).hasMatch("()\n()")); 79 assertTrue(new RegExp(r"^([()]|.)*$", multiLine: true).hasMatch("()\n()"));
81 assertTrue(new RegExp(r"^([()]|.)*$", multiLine: true).hasMatch("()\n")); 80 assertTrue(new RegExp(r"^([()]|.)*$", multiLine: true).hasMatch("()\n"));
82 assertTrue(new RegExp(r"^[()]*$", multiLine: true).hasMatch("()\n.")); 81 assertTrue(new RegExp(r"^[()]*$", multiLine: true).hasMatch("()\n."));
83 82
84 assertTrue(new RegExp(r"^[\].]*$").hasMatch("...]...")); 83 assertTrue(new RegExp(r"^[\].]*$").hasMatch("...]..."));
85 84
86
87 dynamic check_case(lc, uc) { 85 dynamic check_case(lc, uc) {
88 var a = new RegExp("^" + lc + r"$"); 86 var a = new RegExp("^" + lc + r"$");
89 assertFalse(a.hasMatch(uc)); 87 assertFalse(a.hasMatch(uc));
90 a = new RegExp("^" + lc + r"$", caseSensitive: false); 88 a = new RegExp("^" + lc + r"$", caseSensitive: false);
91 assertTrue(a.hasMatch(uc)); 89 assertTrue(a.hasMatch(uc));
92 90
93 var A = new RegExp("^" + uc + r"$"); 91 var A = new RegExp("^" + uc + r"$");
94 assertFalse(A.hasMatch(lc)); 92 assertFalse(A.hasMatch(lc));
95 A = new RegExp("^" + uc + r"$", caseSensitive: false); 93 A = new RegExp("^" + uc + r"$", caseSensitive: false);
96 assertTrue(A.hasMatch(lc)); 94 assertTrue(A.hasMatch(lc));
97 95
98 a = new RegExp("^[" + lc + r"]$"); 96 a = new RegExp("^[" + lc + r"]$");
99 assertFalse(a.hasMatch(uc)); 97 assertFalse(a.hasMatch(uc));
100 a = new RegExp("^[" + lc + r"]$", caseSensitive: false); 98 a = new RegExp("^[" + lc + r"]$", caseSensitive: false);
101 assertTrue(a.hasMatch(uc)); 99 assertTrue(a.hasMatch(uc));
102 100
103 A = new RegExp("^[" + uc + r"]$"); 101 A = new RegExp("^[" + uc + r"]$");
104 assertFalse(A.hasMatch(lc)); 102 assertFalse(A.hasMatch(lc));
105 A = new RegExp("^[" + uc + r"]$", caseSensitive: false); 103 A = new RegExp("^[" + uc + r"]$", caseSensitive: false);
106 assertTrue(A.hasMatch(lc)); 104 assertTrue(A.hasMatch(lc));
107 } 105 }
108 106
109
110 check_case("a", "A"); 107 check_case("a", "A");
111 // Aring 108 // Aring
112 check_case(new String.fromCharCode(229), new String.fromCharCode(197)); 109 check_case(new String.fromCharCode(229), new String.fromCharCode(197));
113 // Russian G 110 // Russian G
114 check_case(new String.fromCharCode(0x413), new String.fromCharCode(0x433)); 111 check_case(new String.fromCharCode(0x413), new String.fromCharCode(0x433));
115 112
116
117 assertThrows(() => new RegExp('[z-a]')); 113 assertThrows(() => new RegExp('[z-a]'));
118 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698