OLD | NEW |
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 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; |
6 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
7 | 8 |
8 const String TEST_ONE = r""" | 9 const String TEST_ONE = r""" |
9 void foo(bar) { | 10 void foo(bar) { |
10 for (int i = 0; i < 1; i++) { | 11 for (int i = 0; i < 1; i++) { |
11 print(1 + bar); | 12 print(1 + bar); |
12 print(1 + bar); | 13 print(1 + bar); |
13 } | 14 } |
14 } | 15 } |
15 """; | 16 """; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 112 |
112 generated = compile(TEST_TWO, entry: 'foo'); | 113 generated = compile(TEST_TWO, entry: 'foo'); |
113 checkNumberOfMatches(new RegExp("length").allMatches(generated).iterator, 1); | 114 checkNumberOfMatches(new RegExp("length").allMatches(generated).iterator, 1); |
114 | 115 |
115 generated = compile(TEST_THREE, entry: 'foo'); | 116 generated = compile(TEST_THREE, entry: 'foo'); |
116 checkNumberOfMatches(new RegExp("number").allMatches(generated).iterator, 1); | 117 checkNumberOfMatches(new RegExp("number").allMatches(generated).iterator, 1); |
117 | 118 |
118 generated = compile(TEST_FOUR, entry: 'foo'); | 119 generated = compile(TEST_FOUR, entry: 'foo'); |
119 checkNumberOfMatches(new RegExp("shr").allMatches(generated).iterator, 1); | 120 checkNumberOfMatches(new RegExp("shr").allMatches(generated).iterator, 1); |
120 | 121 |
121 generated = compileAll(TEST_FIVE); | 122 asyncTest(() => compileAll(TEST_FIVE).then((generated) { |
122 checkNumberOfMatches( | 123 checkNumberOfMatches( |
123 new RegExp("get\\\$foo").allMatches(generated).iterator, 1); | 124 new RegExp("get\\\$foo").allMatches(generated).iterator, 1); |
| 125 })); |
124 | 126 |
125 generated = compileAll(TEST_SIX); | 127 asyncTest(() => compileAll(TEST_SIX).then((generated) { |
126 Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)')); | 128 Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)')); |
| 129 })); |
127 | 130 |
128 generated = compileAll(TEST_SEVEN); | 131 asyncTest(() => compileAll(TEST_SEVEN).then((generated) { |
129 Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)')); | 132 Expect.isTrue(generated.contains('for (t1 = a.field === 54; t1;)')); |
| 133 })); |
130 | 134 |
131 generated = compileAll(TEST_EIGHT); | 135 asyncTest(() => compileAll(TEST_EIGHT).then((generated) { |
132 Expect.isTrue(generated.contains('for (; i < t1; ++i)')); | 136 Expect.isTrue(generated.contains('for (; i < t1; ++i)')); |
| 137 })); |
133 } | 138 } |
OLD | NEW |