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

Side by Side Diff: tests/compiler/dart2js/interpolation_folding_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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 import 'dart:async';
6 import 'package:async_helper/async_helper.dart';
5 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
6 import 'compiler_helper.dart'; 8 import 'compiler_helper.dart';
7 9
8 // Tests for 10 // Tests for
9 const String TEST_1 = r""" 11 const String TEST_1 = r"""
10 foo() { 12 foo() {
11 int a = 120; 13 int a = 120;
12 String b = 'hello'; 14 String b = 'hello';
13 return 'u${a}v${b}w'; 15 return 'u${a}v${b}w';
14 } 16 }
(...skipping 15 matching lines...) Expand all
30 32
31 const String TEST_4 = r""" 33 const String TEST_4 = r"""
32 foo(a) { 34 foo(a) {
33 var b = []; 35 var b = [];
34 if (a) b.add(123); 36 if (a) b.add(123);
35 return '${b.length}'; 37 return '${b.length}';
36 } 38 }
37 """; 39 """;
38 40
39 main() { 41 main() {
40 void check(String test, String contained) { 42 Future check(String test, String contained) {
41 var generated = compile(test, entry: 'foo'); 43 return compile(test, entry: 'foo').then((String generated) {
42 Expect.isTrue(generated.contains(contained), contained); 44 Expect.isTrue(generated.contains(contained), contained);
45 });
43 } 46 }
44 47
45 // Full substitution. 48 asyncTest(() => Future.wait([
46 check(TEST_1, r'"u120vhellow"'); 49 // Full substitution.
50 check(TEST_1, r'"u120vhellow"'),
47 51
48 // Adjacent string fragments get merged. 52 // Adjacent string fragments get merged.
49 check(TEST_2, r'"xxxxxyyyyy"'); 53 check(TEST_2, r'"xxxxxyyyyy"'),
50 54
51 // 1. No merging of fragments that are multi-use. Prevents exponential code 55 // 1. No merging of fragments that are multi-use. Prevents exponential code
52 // and keeps author's manual CSE. 56 // and keeps author's manual CSE.
53 // 2. Know string values require no stringification. 57 // 2. Know string values require no stringification.
54 check(TEST_3, r'return b + "x" + b'); 58 check(TEST_3, r'return b + "x" + b'),
55 59
56 // Known int value can be formatted directly. 60 // Known int value can be formatted directly.
57 check(TEST_4, r'return "" + b.length'); 61 check(TEST_4, r'return "" + b.length'),
62 ]));
58 } 63 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/interceptor_test.dart ('k') | tests/compiler/dart2js/inverse_operator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698