Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: packages/initialize/test/initializer_type_filter_test.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4
5 // TODO(jakemac): swap this to @TestOn('pub-serve') once 5 // TODO(jakemac): swap this to @TestOn('pub-serve') once
6 // https://github.com/dart-lang/test/issues/388 is completed. 6 // https://github.com/dart-lang/test/issues/388 is completed.
7 @TestOn('!js') 7 @TestOn('!js')
8 library initialize.initializer_type_filter_test; 8 library initialize.initializer_type_filter_test;
9 9
10 import 'package:initialize/initialize.dart'; 10 import 'package:initialize/initialize.dart';
11 import 'package:test/test.dart'; 11 import 'package:test/test.dart';
12 12
13 // 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
14 // start of every test. 14 // start of every test.
15 var total; 15 var total;
16 16
17 main() { 17 main() {
18 setUp(() { 18 setUp(() {
19 total = 0; 19 total = 0;
20 }); 20 });
21 21
22 test('filter option limits which types of annotations will be ran', () { 22 test('filter option limits which types of annotations will be ran', () {
23 return run(typeFilter: const [_Adder]).then((_) { 23 return run(typeFilter: const [_Adder])
24 expect(total, 2); 24 .then((_) {
25 }).then((_) => run(typeFilter: const [_Subtractor])).then((_) { 25 expect(total, 2);
26 expect(total, 0); 26 })
27 }).then((_) => run(typeFilter: const [_Adder])).then((_) { 27 .then((_) => run(typeFilter: const [_Subtractor]))
28 // Sanity check, future calls should be no-ops 28 .then((_) {
29 expect(total, 0); 29 expect(total, 0);
30 }).then((_) => run(typeFilter: const [_Subtractor])).then((_) { 30 })
31 expect(total, 0); 31 .then((_) => run(typeFilter: const [_Adder]))
32 }); 32 .then((_) {
33 // Sanity check, future calls should be no-ops
34 expect(total, 0);
35 })
36 .then((_) => run(typeFilter: const [_Subtractor]))
37 .then((_) {
38 expect(total, 0);
39 });
33 }); 40 });
34 } 41 }
35 42
36 @adder 43 @adder
37 a() {} 44 a() {}
38 @subtractor 45 @subtractor
39 b() {} 46 b() {}
40 @adder 47 @adder
41 @subtractor 48 @subtractor
42 c() {} 49 c() {}
43 50
44 // Initializer that increments `total` by one. 51 // Initializer that increments `total` by one.
45 class _Adder implements Initializer<dynamic> { 52 class _Adder implements Initializer<dynamic> {
46 const _Adder(); 53 const _Adder();
47 54
48 @override 55 @override
49 initialize(_) => total++; 56 initialize(_) => total++;
50 } 57 }
58
51 const adder = const _Adder(); 59 const adder = const _Adder();
52 60
53 // Initializer that decrements `total` by one. 61 // Initializer that decrements `total` by one.
54 class _Subtractor implements Initializer<dynamic> { 62 class _Subtractor implements Initializer<dynamic> {
55 const _Subtractor(); 63 const _Subtractor();
56 64
57 @override 65 @override
58 initialize(_) => total--; 66 initialize(_) => total--;
59 } 67 }
68
60 const subtractor = const _Subtractor(); 69 const subtractor = const _Subtractor();
OLDNEW
« no previous file with comments | « packages/initialize/test/initializer_super_test.dart ('k') | packages/initialize/test/transformer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698