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

Side by Side Diff: tests/compiler/dart2js/generate_at_use_site_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/for_in_test.dart ('k') | tests/compiler/dart2js/gvn_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 FIB = r""" 10 const String FIB = r"""
9 fib(n) { 11 fib(n) {
10 if (n <= 1) return 1; 12 if (n <= 1) return 1;
11 return add(fib(n - 1), fib(n - 2)); 13 return add(fib(n - 1), fib(n - 2));
12 } 14 }
13 15
14 // We need this artificial add method because 16 // We need this artificial add method because
15 // our optimizer will actually add type checks 17 // our optimizer will actually add type checks
(...skipping 26 matching lines...) Expand all
42 // snippet). 44 // snippet).
43 const String TEST = r""" 45 const String TEST = r"""
44 foo(a) { 46 foo(a) {
45 if (a is !int) throw a; 47 if (a is !int) throw a;
46 if (a < 0) throw a; 48 if (a < 0) throw a;
47 return a + a; 49 return a + a;
48 } 50 }
49 """; 51 """;
50 52
51 main() { 53 main() {
52 // Make sure we don't introduce a new variable. 54 asyncTest(() => Future.wait([
53 RegExp regexp = new RegExp("var $anyIdentifier ="); 55 // Make sure we don't introduce a new variable.
54 compileAndDoNotMatch(FIB, 'fib', regexp); 56 compileAndDoNotMatch(FIB, 'fib', new RegExp("var $anyIdentifier =")),
55 57
56 regexp = new RegExp("isLeaf"); 58 compileAndDoNotMatch(BAR, 'bar', new RegExp("isLeaf")),
57 compileAndDoNotMatch(BAR, 'bar', regexp);
58 59
59 String generated = compile(TEST, entry: 'foo'); 60 compile(TEST, entry: 'foo', check: (String generated) {
60 Expect.isFalse(generated.contains('else')); 61 Expect.isFalse(generated.contains('else'));
61 // Regression check to ensure that there is no floating variable 62 // Regression check to ensure that there is no floating variable
62 // expression. 63 // expression.
63 Expect.isFalse(new RegExp('^[ ]*a;').hasMatch(generated)); 64 Expect.isFalse(new RegExp('^[ ]*a;').hasMatch(generated));
65 }),
66 ]));
64 } 67 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/for_in_test.dart ('k') | tests/compiler/dart2js/gvn_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698