OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 @initializeTracker |
| 5 library initialize.initializer_test; |
| 6 |
| 7 import 'foo/bar.dart'; |
| 8 import 'package:initialize/src/initialize_tracker.dart'; |
| 9 import 'package:initialize/initialize.dart'; |
| 10 import 'package:test_package/foo.dart'; |
| 11 import 'package:unittest/unittest.dart'; |
| 12 import 'package:unittest/compact_vm_config.dart'; |
| 13 |
| 14 main() { |
| 15 useCompactVMConfiguration(); |
| 16 |
| 17 // Run all initializers. |
| 18 run().then((_) { |
| 19 test('annotations are seen in post-order with superclasses first', () { |
| 20 var expectedNames = [ |
| 21 const LibraryIdentifier(#initialize.test.foo, null, 'foo.dart'), |
| 22 fooBar, |
| 23 foo, |
| 24 Foo, |
| 25 const LibraryIdentifier(#initialize.test.foo.bar, null, 'foo/bar.dart'), |
| 26 bar, |
| 27 Bar, |
| 28 const LibraryIdentifier(#test_package.bar, 'test_package', 'bar.dart'), |
| 29 const LibraryIdentifier(#test_package.foo, 'test_package', 'foo.dart'), |
| 30 const LibraryIdentifier( |
| 31 #initialize.initializer_test, null, 'initializer_test.dart'), |
| 32 zap, |
| 33 Zoop, // Zap extends Zoop, so Zoop comes first. |
| 34 Zap, |
| 35 ]; |
| 36 expect(InitializeTracker.seen, expectedNames); |
| 37 }); |
| 38 |
| 39 test('annotations only run once', () { |
| 40 // Run the initializers again, should be a no-op. |
| 41 var originalSize = InitializeTracker.seen.length; |
| 42 return run().then((_) { |
| 43 expect(InitializeTracker.seen.length, originalSize); |
| 44 }); |
| 45 }); |
| 46 }); |
| 47 } |
| 48 |
| 49 @initializeTracker |
| 50 class Zoop {} |
| 51 |
| 52 @initializeTracker |
| 53 class Zap extends Zoop {} |
| 54 |
| 55 @initializeTracker |
| 56 zap() {} |
OLD | NEW |