OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 library initialize.test.build.common; |
| 5 |
| 6 import 'package:barback/barback.dart'; |
| 7 import 'package:code_transformers/src/test_harness.dart'; |
| 8 import 'package:unittest/unittest.dart'; |
| 9 |
| 10 testPhases(String testName, List<List<Transformer>> phases, |
| 11 Map<String, String> inputFiles, Map<String, String> expectedFiles, |
| 12 [List<String> expectedMessages]) { |
| 13 test(testName, () { |
| 14 var helper = new TestHelper(phases, inputFiles, expectedMessages)..run(); |
| 15 return helper.checkAll(expectedFiles).whenComplete(() => helper.tearDown()); |
| 16 }); |
| 17 } |
| 18 |
| 19 // Simple mock of initialize. |
| 20 const mockInitialize = ''' |
| 21 library initialize; |
| 22 |
| 23 abstract class Initializer<T> {} |
| 24 |
| 25 class _InitMethod implements Initializer<Function> { |
| 26 const _InitMethod(); |
| 27 } |
| 28 const _InitMethod initMethod = const _InitMethod();'''; |
| 29 |
| 30 // Some simple initializers for use in tests. |
| 31 const commonInitializers = ''' |
| 32 library test_initializers; |
| 33 |
| 34 import 'package:initialize/initialize.dart'; |
| 35 |
| 36 class _ConstInit extends Initializer<dynamic> { |
| 37 const ConstInit(); |
| 38 } |
| 39 const _ConstInit constInit = const _ConstInit(); |
| 40 |
| 41 class DynamicInit extends Initializer<dynamic> { |
| 42 final dynamic _value; |
| 43 const DynamicInit(this._value); |
| 44 } |
| 45 |
| 46 class NamedArgInit extends Initializer<dynamic> { |
| 47 final dynamic _first; |
| 48 final dynamic name; |
| 49 const NamedArgInit(this._first, {this.name}); |
| 50 } |
| 51 '''; |
OLD | NEW |