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

Side by Side Diff: tests/compiler/dart2js/interceptor_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 "package:expect/expect.dart"; 5 import 'dart:async';
6 import 'package:expect/expect.dart';
7 import 'package:async_helper/async_helper.dart';
6 import 'compiler_helper.dart'; 8 import 'compiler_helper.dart';
7 9
8 const String TEST_ONE = r""" 10 const String TEST_ONE = r"""
9 foo(a) { 11 foo(a) {
10 var myVariableName = a.toString(); 12 var myVariableName = a.toString();
11 print(myVariableName); 13 print(myVariableName);
12 print(myVariableName); 14 print(myVariableName);
13 } 15 }
14 """; 16 """;
15 17
16 const String TEST_TWO = r""" 18 const String TEST_TWO = r"""
17 class A { 19 class A {
18 var length; 20 var length;
19 } 21 }
20 foo(a) { 22 foo(a) {
21 print([]); // Make sure the array class is instantiated. 23 print([]); // Make sure the array class is instantiated.
22 return new A().length + a.length; 24 return new A().length + a.length;
23 } 25 }
24 """; 26 """;
25 27
26 main() { 28 main() {
27 // Check that one-shot interceptors preserve variable names, see 29 asyncTest(() => Future.wait([
28 // https://code.google.com/p/dart/issues/detail?id=8106. 30 // Check that one-shot interceptors preserve variable names, see
29 String generated = compile(TEST_ONE, entry: 'foo'); 31 // https://code.google.com/p/dart/issues/detail?id=8106.
30 Expect.isTrue(generated.contains(new RegExp(r'[$A-Z]+\.toString\$0\(a\)'))); 32 compile(TEST_ONE, entry: 'foo', check: (String generated) {
31 Expect.isTrue(generated.contains('myVariableName')); 33 Expect.isTrue(
32 34 generated.contains(new RegExp(r'[$A-Z]+\.toString\$0\(a\)')));
33 // Check that an intercepted getter that does not need to be 35 Expect.isTrue(generated.contains('myVariableName'));
34 // intercepted, is turned into a regular getter call or field 36 }),
35 // access. 37 // Check that an intercepted getter that does not need to be
36 generated = compile(TEST_TWO, entry: 'foo'); 38 // intercepted, is turned into a regular getter call or field
37 Expect.isFalse(generated.contains(r'a.get$length()')); 39 // access.
38 Expect.isTrue(generated.contains(new RegExp(r'[$A-Z]+\.A\$\(\)\.length'))); 40 compile(TEST_TWO, entry: 'foo', check: (String generated) {
39 Expect.isTrue( 41 Expect.isFalse(generated.contains(r'a.get$length()'));
40 generated.contains(new RegExp(r'[$A-Z]+\.get\$length\$as\(a\)'))); 42 Expect.isTrue(
43 generated.contains(new RegExp(r'[$A-Z]+\.A\$\(\)\.length')));
44 Expect.isTrue(
45 generated.contains(new RegExp(r'[$A-Z]+\.get\$length\$as\(a\)')));
46 }),
47 ]));
41 } 48 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/identity_test.dart ('k') | tests/compiler/dart2js/interpolation_folding_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698