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

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

Issue 326913002: Make dart2js unittests async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 6 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/patch_test.dart ('k') | tests/compiler/dart2js/private_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) 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 "package:expect/expect.dart"; 6 import 'dart:async';
7 import 'package:expect/expect.dart';
8 import 'package:async_helper/async_helper.dart';
7 import 'compiler_helper.dart'; 9 import 'compiler_helper.dart';
8 10
9 const String FOO = r""" 11 const String FOO = r"""
10 void foo(var a, var b) { 12 void foo(var a, var b) {
11 } 13 }
12 """; 14 """;
13 15
14 const String BAR = r""" 16 const String BAR = r"""
15 void bar(var eval, var $eval) { 17 void bar(var eval, var $eval) {
16 } 18 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 var result = start; 66 var result = start;
65 if (test) { 67 if (test) {
66 foo(1, 2); 68 foo(1, 2);
67 result = 42; 69 result = 42;
68 } 70 }
69 print(result); 71 print(result);
70 } 72 }
71 """; 73 """;
72 74
73 main() { 75 main() {
74 String generated = compile(FOO, entry: 'foo'); 76 asyncTest(() => Future.wait([
75 Expect.isTrue(generated.contains(r"function(a, b) {")); 77 compile(FOO, entry: 'foo', check: (String generated) {
78 Expect.isTrue(generated.contains(r"function(a, b) {"));
79 }),
76 80
77 generated = compile(BAR, entry: 'bar'); 81 compile(BAR, entry: 'bar', check: (String generated) {
78 Expect.isTrue(generated.contains(r"function($eval, $$eval) {")); 82 Expect.isTrue(generated.contains(r"function($eval, $$eval) {"));
83 }),
79 84
80 generated = compile(PARAMETER_AND_TEMP, entry: 'bar'); 85 compile(PARAMETER_AND_TEMP, entry: 'bar', check: (String generated) {
81 Expect.isTrue(generated.contains(r"print(t00)")); 86 Expect.isTrue(generated.contains(r"print(t00)"));
82 // Check that the second 't0' got another name. 87 // Check that the second 't0' got another name.
83 Expect.isTrue(generated.contains(r"print(t01)")); 88 Expect.isTrue(generated.contains(r"print(t01)"));
89 }),
84 90
85 generated = compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo'); 91 compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo', check: (String generated) {
86 Expect.isTrue(generated.contains("var a;")); 92 Expect.isTrue(generated.contains("var a;"));
87 // Check that there is only one var declaration. 93 // Check that there is only one var declaration.
88 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); 94 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1);
95 }),
89 96
90 generated = compile(NO_LOCAL, entry: 'foo'); 97 compile(NO_LOCAL, entry: 'foo', check: (String generated) {
91 Expect.isFalse(generated.contains('var')); 98 Expect.isFalse(generated.contains('var'));
99 }),
92 100
93 generated = compile(PARAMETER_INIT, entry: 'foo'); 101 compile(PARAMETER_INIT, entry: 'foo', check: (String generated) {
94 // Check that there is only one var declaration. 102 // Check that there is only one var declaration.
95 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); 103 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1);
104 }),
105 ]));
96 } 106 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/patch_test.dart ('k') | tests/compiler/dart2js/private_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698