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 'dart:async'; | 5 import 'dart:async'; |
6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 | 9 |
10 const String TEST_ONE = r""" | 10 const String TEST_ONE = r""" |
11 foo() { | 11 foo() { |
12 return "foo".length; | 12 return "foo".length; |
13 } | 13 } |
14 """; | 14 """; |
15 | 15 |
16 const String TEST_TWO = r""" | 16 const String TEST_TWO = r""" |
17 foo() { | 17 foo() { |
18 return r"foo".length; | 18 return r"foo".length; |
19 } | 19 } |
20 """; | 20 """; |
21 | 21 |
22 const String TEST_THREE = r""" | 22 const String TEST_THREE = r""" |
23 foo() { | 23 foo() { |
24 return new List().add(2); | 24 return new List().add(2); |
25 } | 25 } |
26 """; | 26 """; |
27 | 27 |
28 main() { | 28 main() { |
29 asyncTest(() => Future.wait([ | 29 asyncTest(() => Future.wait([ |
30 compile(TEST_ONE, entry: 'foo', check: (String generated) { | 30 compile(TEST_ONE, entry: 'foo', check: (String generated) { |
31 Expect.isTrue(generated.contains("return 3;")); | 31 Expect.isTrue(generated.contains("return 3;")); |
32 }), | 32 }), |
33 compile(TEST_TWO, entry: 'foo', check: (String generated) { | 33 compile(TEST_TWO, entry: 'foo', check: (String generated) { |
34 Expect.isTrue(generated.contains("return 3;")); | 34 Expect.isTrue(generated.contains("return 3;")); |
35 }), | 35 }), |
36 compile(TEST_THREE, entry: 'foo', check: (String generated) { | 36 compile(TEST_THREE, entry: 'foo', check: (String generated) { |
37 Expect.isTrue(generated.contains("push(2);")); | 37 Expect.isTrue(generated.contains("push(2);")); |
38 }), | 38 }), |
39 ])); | 39 ])); |
40 } | 40 } |
OLD | NEW |