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

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

Issue 891673003: dart2js: Refactoring, documentation, and a few bugfixes in Namer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Typo and TODO about clash in named parameters Created 5 years, 10 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 'dart:async'; 6 import 'dart:async';
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'compiler_helper.dart'; 9 import 'compiler_helper.dart';
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 """; 73 """;
74 74
75 main() { 75 main() {
76 asyncTest(() => Future.wait([ 76 asyncTest(() => Future.wait([
77 compile(FOO, entry: 'foo', check: (String generated) { 77 compile(FOO, entry: 'foo', check: (String generated) {
78 Expect.isTrue(generated.contains(r"function(a, b) {")); 78 Expect.isTrue(generated.contains(r"function(a, b) {"));
79 }), 79 }),
80 80
81 compile(BAR, entry: 'bar', check: (String generated) { 81 compile(BAR, entry: 'bar', check: (String generated) {
82 Expect.isTrue(generated.contains(r"function($eval, $$eval) {")); 82 Expect.isTrue(generated.contains(r"function($eval, $eval0) {"));
sra1 2015/01/30 22:48:27 Can we do something to keep the original names whe
asgerf 2015/02/03 17:39:14 Do you mean "original names" as in, the names from
83 }), 83 }),
84 84
85 compile(PARAMETER_AND_TEMP, entry: 'bar', check: (String generated) { 85 compile(PARAMETER_AND_TEMP, entry: 'bar', check: (String generated) {
86 Expect.isTrue(generated.contains(r"print(t00)")); 86 Expect.isTrue(generated.contains(r"print(t00)"));
87 // Check that the second 't0' got another name. 87 // Check that the second 't0' got another name.
88 Expect.isTrue(generated.contains(r"print(t01)")); 88 Expect.isTrue(generated.contains(r"print(t01)"));
89 }), 89 }),
90 90
91 compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo', check: (String generated) { 91 compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo', check: (String generated) {
92 Expect.isTrue(generated.contains("var a;")); 92 Expect.isTrue(generated.contains("var a;"));
93 // Check that there is only one var declaration. 93 // Check that there is only one var declaration.
94 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); 94 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1);
95 }), 95 }),
96 96
97 compile(NO_LOCAL, entry: 'foo', check: (String generated) { 97 compile(NO_LOCAL, entry: 'foo', check: (String generated) {
98 Expect.isFalse(generated.contains('var')); 98 Expect.isFalse(generated.contains('var'));
99 }), 99 }),
100 100
101 compile(PARAMETER_INIT, entry: 'foo', check: (String generated) { 101 compile(PARAMETER_INIT, entry: 'foo', check: (String generated) {
102 // Check that there is only one var declaration. 102 // Check that there is only one var declaration.
103 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); 103 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1);
104 }), 104 }),
105 ])); 105 ]));
106 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698