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

Side by Side Diff: tests/compiler/dart2js/compiler_helper.dart

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « tests/compiler/dart2js/begin_end_token_test.dart ('k') | tests/compiler/dart2js/link_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Test constant folding. 4 // Test constant folding.
5 5
6 library compiler_helper; 6 library compiler_helper;
7 7
8 import "dart:uri"; 8 import "dart:uri";
9 9
10 import "../../../lib/compiler/implementation/elements/elements.dart" as lego; 10 import "../../../lib/compiler/implementation/elements/elements.dart" as lego;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Expect.isTrue(regexp.hasMatch(generated), 88 Expect.isTrue(regexp.hasMatch(generated),
89 '"$generated" does not match /$regexp/'); 89 '"$generated" does not match /$regexp/');
90 } 90 }
91 91
92 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 92 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
93 String generated = compile(code, entry: entry); 93 String generated = compile(code, entry: entry);
94 Expect.isFalse(regexp.hasMatch(generated), 94 Expect.isFalse(regexp.hasMatch(generated),
95 '"$generated" has a match in /$regexp/'); 95 '"$generated" has a match in /$regexp/');
96 } 96 }
97 97
98 int length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1; 98 int length(Link link) => link.isEmpty ? 0 : length(link.tail) + 1;
99 99
100 // Does a compile and then a match where every 'x' is replaced by something 100 // Does a compile and then a match where every 'x' is replaced by something
101 // that matches any variable, and every space is optional. 101 // that matches any variable, and every space is optional.
102 void compileAndMatchFuzzy(String code, String entry, String regexp) { 102 void compileAndMatchFuzzy(String code, String entry, String regexp) {
103 compileAndMatchFuzzyHelper(code, entry, regexp, true); 103 compileAndMatchFuzzyHelper(code, entry, regexp, true);
104 } 104 }
105 105
106 void compileAndDoNotMatchFuzzy(String code, String entry, String regexp) { 106 void compileAndDoNotMatchFuzzy(String code, String entry, String regexp) {
107 compileAndMatchFuzzyHelper(code, entry, regexp, false); 107 compileAndMatchFuzzyHelper(code, entry, regexp, false);
108 } 108 }
109 109
110 void compileAndMatchFuzzyHelper( 110 void compileAndMatchFuzzyHelper(
111 String code, String entry, String regexp, bool shouldMatch) { 111 String code, String entry, String regexp, bool shouldMatch) {
112 String generated = compile(code, entry: entry); 112 String generated = compile(code, entry: entry);
113 final xRe = new RegExp('\\bx\\b'); 113 final xRe = new RegExp('\\bx\\b');
114 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 114 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
115 final spaceRe = new RegExp('\\s+'); 115 final spaceRe = new RegExp('\\s+');
116 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 116 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
117 if (shouldMatch) { 117 if (shouldMatch) {
118 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 118 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
119 } else { 119 } else {
120 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 120 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
121 } 121 }
122 } 122 }
123 123
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/begin_end_token_test.dart ('k') | tests/compiler/dart2js/link_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698