OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.initializer_custom_filter_test; | 4 library initialize.initializer_custom_filter_test; |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:initialize/initialize.dart'; | 7 import 'package:initialize/initialize.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'package:unittest/compact_vm_config.dart'; | 9 import 'package:unittest/compact_vm_config.dart'; |
10 import 'initialize_tracker.dart'; | 10 import 'package:initialize/src/initialize_tracker.dart'; |
11 | 11 |
12 main() { | 12 main() { |
13 useCompactVMConfiguration(); | 13 useCompactVMConfiguration(); |
14 | 14 |
15 test('filter option limits which types of annotations will be ran', () { | 15 test('filter option limits which types of annotations will be ran', () { |
16 var originalSize; | 16 var originalSize; |
17 return runPhase(1).then((_) { | 17 return runPhase(1).then((_) { |
18 // Even though Baz extends Bar, only Baz should be run. | 18 // Even though Baz extends Bar, only Baz should be run. |
19 expect(InitializeTracker.seen, [Baz]); | 19 expect(InitializeTracker.seen, [Baz]); |
20 }).then((_) => runPhase(2)).then((_) { | 20 }).then((_) => runPhase(2)).then((_) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 @PhasedInitializer(1) | 53 @PhasedInitializer(1) |
54 class Baz extends Bar {} | 54 class Baz extends Bar {} |
55 | 55 |
56 // Initializer that has a phase associated with it, this can be used in | 56 // Initializer that has a phase associated with it, this can be used in |
57 // combination with a custom filter to run intialization in phases. | 57 // combination with a custom filter to run intialization in phases. |
58 class PhasedInitializer extends InitializeTracker { | 58 class PhasedInitializer extends InitializeTracker { |
59 final int phase; | 59 final int phase; |
60 | 60 |
61 const PhasedInitializer(this.phase); | 61 const PhasedInitializer(this.phase); |
62 } | 62 } |
OLD | NEW |