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 |
| 5 // TODO(jakemac): swap this to @TestOn('pub-serve') once |
| 6 // https://github.com/dart-lang/test/issues/388 is completed. |
| 7 @TestOn('!js') |
4 library initialize.initializer_type_filter_test; | 8 library initialize.initializer_type_filter_test; |
5 | 9 |
6 import 'package:initialize/initialize.dart'; | 10 import 'package:initialize/initialize.dart'; |
7 import 'package:unittest/unittest.dart'; | 11 import 'package:test/test.dart'; |
8 import 'package:unittest/compact_vm_config.dart'; | |
9 | 12 |
10 // Initializers will mess with this value, and it gets reset to 0 at the | 13 // Initializers will mess with this value, and it gets reset to 0 at the |
11 // start of every test. | 14 // start of every test. |
12 var total; | 15 var total; |
13 | 16 |
14 main() { | 17 main() { |
15 useCompactVMConfiguration(); | |
16 | |
17 setUp(() { | 18 setUp(() { |
18 total = 0; | 19 total = 0; |
19 }); | 20 }); |
20 | 21 |
21 test('filter option limits which types of annotations will be ran', () { | 22 test('filter option limits which types of annotations will be ran', () { |
22 return run(typeFilter: const [_Adder]).then((_) { | 23 return run(typeFilter: const [_Adder]).then((_) { |
23 expect(total, 2); | 24 expect(total, 2); |
24 }).then((_) => run(typeFilter: const [_Subtractor])).then((_) { | 25 }).then((_) => run(typeFilter: const [_Subtractor])).then((_) { |
25 expect(total, 0); | 26 expect(total, 0); |
26 }).then((_) => run(typeFilter: const [_Adder])).then((_) { | 27 }).then((_) => run(typeFilter: const [_Adder])).then((_) { |
(...skipping 23 matching lines...) Expand all Loading... |
50 const adder = const _Adder(); | 51 const adder = const _Adder(); |
51 | 52 |
52 // Initializer that decrements `total` by one. | 53 // Initializer that decrements `total` by one. |
53 class _Subtractor implements Initializer<dynamic> { | 54 class _Subtractor implements Initializer<dynamic> { |
54 const _Subtractor(); | 55 const _Subtractor(); |
55 | 56 |
56 @override | 57 @override |
57 initialize(_) => total--; | 58 initialize(_) => total--; |
58 } | 59 } |
59 const subtractor = const _Subtractor(); | 60 const subtractor = const _Subtractor(); |
OLD | NEW |