Chromium Code Reviews| 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 library initialize.test.build.common; | 4 library initialize.test.build.common; |
| 5 | 5 |
| 6 import 'package:barback/barback.dart'; | 6 import 'package:barback/barback.dart'; |
| 7 import 'package:code_transformers/src/test_harness.dart'; | 7 import 'package:code_transformers/src/test_harness.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 testPhases(String testName, List<List<Transformer>> phases, | 10 testPhases(String testName, List<List<Transformer>> phases, |
| 11 Map<String, String> inputFiles, Map<String, String> expectedFiles, | 11 Map<String, String> inputFiles, Map<String, String> expectedFiles, |
| 12 [List<String> expectedMessages]) { | 12 [List<String> expectedMessages]) { |
| 13 test(testName, () { | 13 test(testName, () { |
| 14 var helper = new TestHelper(phases, inputFiles, expectedMessages)..run(); | 14 var helper = new TestHelper(phases, inputFiles, expectedMessages)..run(); |
| 15 return helper.checkAll(expectedFiles).whenComplete(() => helper.tearDown()); | 15 return helper.checkAll(expectedFiles).whenComplete(() => helper.tearDown()); |
| 16 }); | 16 }); |
| 17 } | 17 } |
| 18 | |
| 19 // Simple mock of initialize, plus some extra annotations for fun. | |
| 20 const mockInitialize = ''' | |
| 21 library initialize; | |
| 22 | |
| 23 abstract class Initializer<T> {} | |
| 24 | |
| 25 class _ConstInit extends Initializer<dynamic> { | |
| 26 const ConstInit(); | |
| 27 } | |
| 28 const _ConstInit constInit = const _ConstInit(); | |
| 29 | |
| 30 class DynamicInit extends Initializer<dynamic> { | |
|
Siggi Cherem (dart-lang)
2015/01/23 17:56:28
I think we should keep this mockInitialize as a su
jakemac
2015/01/23 21:34:38
Done.
| |
| 31 final String _name; | |
| 32 const DynamicInit(this._name); | |
| 33 } | |
| 34 | |
| 35 class _InitMethod implements Initializer<Function> { | |
| 36 const _InitMethod(); | |
| 37 } | |
| 38 const _InitMethod initMethod = const _InitMethod();'''; | |
| OLD | NEW |