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

Side by Side Diff: frog/tests/leg/src/PrettyParameterTest.dart

Issue 9592009: Reapply "Refactor constant part." (r4958) with fixes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update tests and fix code after renaming. Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 that parameters keep their names in the output. 4 // Test that parameters keep their names in the output.
5 5
6 #import("compiler_helper.dart"); 6 #import("compiler_helper.dart");
7 7
8 final String FOO = @""" 8 final String FOO = @"""
9 void foo(var a, var b) { 9 void foo(var a, var b) {
10 } 10 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 """; 68 """;
69 69
70 main() { 70 main() {
71 String generated = compile(FOO, 'foo'); 71 String generated = compile(FOO, 'foo');
72 // TODO(ngeoffray): Use 'contains' when frog supports it. 72 // TODO(ngeoffray): Use 'contains' when frog supports it.
73 RegExp regexp = const RegExp(@"function\(a, b\) {"); 73 RegExp regexp = const RegExp(@"function\(a, b\) {");
74 Expect.isTrue(regexp.hasMatch(generated)); 74 Expect.isTrue(regexp.hasMatch(generated));
75 75
76 generated = compile(BAR, 'bar'); 76 generated = compile(BAR, 'bar');
77 regexp = const RegExp(@"function\(eval\$, \$\$eval\) {"); 77 regexp = const RegExp(@"function\(eval\$, \$\$eval\) {");
78 print(generated);
79 Expect.isTrue(regexp.hasMatch(generated)); 78 Expect.isTrue(regexp.hasMatch(generated));
80 79
81 generated = compile(PARAMETER_AND_TEMP, 'bar'); 80 generated = compile(PARAMETER_AND_TEMP, 'bar');
82 regexp = const RegExp(@"print\$1\(t0\)"); 81 regexp = const RegExp(@"print\$1\(t0\)");
83 Expect.isTrue(regexp.hasMatch(generated)); 82 Expect.isTrue(regexp.hasMatch(generated));
84 // Check that the second 't0' got another name. 83 // Check that the second 't0' got another name.
85 regexp = const RegExp(@"print\$1\(t0_0\)"); 84 regexp = const RegExp(@"print\$1\(t0_0\)");
86 Expect.isTrue(regexp.hasMatch(generated)); 85 Expect.isTrue(regexp.hasMatch(generated));
87 86
88 generated = compile(NO_LOCAL, 'foo'); 87 generated = compile(NO_LOCAL, 'foo');
89 regexp = const RegExp("return baz"); 88 regexp = const RegExp("return baz");
90 Expect.isTrue(regexp.hasMatch(generated)); 89 Expect.isTrue(regexp.hasMatch(generated));
91 regexp = const RegExp("baz = 2"); 90 regexp = const RegExp(@"baz = \(2\)");
92 Expect.isTrue(regexp.hasMatch(generated)); 91 Expect.isTrue(regexp.hasMatch(generated));
93 regexp = const RegExp("baz = 3"); 92 regexp = const RegExp(@"baz = \(3\)");
94 Expect.isTrue(regexp.hasMatch(generated)); 93 Expect.isTrue(regexp.hasMatch(generated));
95 regexp = const RegExp("bar === true"); 94 regexp = const RegExp("bar === true");
96 Expect.isTrue(regexp.hasMatch(generated)); 95 Expect.isTrue(regexp.hasMatch(generated));
97 96
98 generated = compile(MULTIPLE_PHIS_ONE_LOCAL, 'foo'); 97 generated = compile(MULTIPLE_PHIS_ONE_LOCAL, 'foo');
99 regexp = const RegExp("var a = 2;"); 98 regexp = const RegExp(@"var a = \(2\);");
100 Expect.isTrue(regexp.hasMatch(generated)); 99 Expect.isTrue(regexp.hasMatch(generated));
101 100
102 regexp = const RegExp("a = 2;"); 101 regexp = const RegExp(@"a = \(2\);");
103 Iterator matches = regexp.allMatches(generated).iterator(); 102 Iterator matches = regexp.allMatches(generated).iterator();
104 Expect.isTrue(matches.hasNext()); 103 Expect.isTrue(matches.hasNext());
105 matches.next(); 104 matches.next();
106 Expect.isFalse(matches.hasNext()); 105 Expect.isFalse(matches.hasNext());
107 106
108 generated = compile(PARAMETER_INIT, 'foo'); 107 generated = compile(PARAMETER_INIT, 'foo');
109 regexp = const RegExp("var result = start;"); 108 regexp = const RegExp("var result = start;");
110 Expect.isTrue(regexp.hasMatch(generated)); 109 Expect.isTrue(regexp.hasMatch(generated));
111 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698