| OLD | NEW |
| 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:async_helper/async_helper.dart'; |
| 5 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.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 class Token { | 10 class Token { |
| 10 final name; | 11 final name; |
| 11 final value; | 12 final value; |
| 12 const Token(this.name, [this.value]); | 13 const Token(this.name, [this.value]); |
| 13 use() { print(this); } | 14 use() { print(this); } |
| 14 } | 15 } |
| 15 test() { | 16 test() { |
| 16 const [12,53].use(); | 17 const [12,53].use(); |
| 17 const Token('start').use(); | 18 const Token('start').use(); |
| 18 const Token('end').use(); | 19 const Token('end').use(); |
| 19 const Token('yes', 12).use(); | 20 const Token('yes', 12).use(); |
| 20 const Token(true, false).use(); | 21 const Token(true, false).use(); |
| 21 } | 22 } |
| 22 """; | 23 """; |
| 23 | 24 |
| 24 main() { | 25 main() { |
| 25 check(generated, text) { | 26 check(generated, text) { |
| 26 Expect.isTrue(generated.contains(text), text); | 27 Expect.isTrue(generated.contains(text), text); |
| 27 } | 28 } |
| 28 | 29 |
| 29 var generated = compile(TEST_ONE, entry: 'test'); | 30 asyncTest(() => compile(TEST_ONE, entry: 'test').then((String generated) { |
| 30 | 31 check(generated, '.List_12_53.'); |
| 31 check(generated, '.List_12_53.'); | 32 check(generated, '.Token_start_null.'); |
| 32 check(generated, '.Token_start_null.'); | 33 check(generated, '.Token_end_null.'); |
| 33 check(generated, '.Token_end_null.'); | 34 check(generated, '.Token_yes_12.'); |
| 34 check(generated, '.Token_yes_12.'); | 35 check(generated, '.Token_true_false.'); |
| 35 check(generated, '.Token_true_false.'); | 36 })); |
| 36 } | 37 } |
| OLD | NEW |