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

Side by Side Diff: test/initializer_test.dart

Issue 880713002: add LibraryIdentifier (Closed) Base URL: git@github.com:dart-lang/static-init.git@master
Patch Set: Created 5 years, 11 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 @initializeTracker 4 @initializeTracker
5 library initialize.initializer_test; 5 library initialize.initializer_test;
6 6
7 import 'foo.dart'; 7 import 'foo.dart';
8 import 'bar.dart'; 8 import 'bar.dart';
9 import 'initialize_tracker.dart'; 9 import 'package:initialize/src/initialize_tracker.dart';
10 import 'package:initialize/initialize.dart'; 10 import 'package:initialize/initialize.dart';
11 import 'package:initialize_test_fixtures/foo.dart';
11 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
12 import 'package:unittest/compact_vm_config.dart'; 13 import 'package:unittest/compact_vm_config.dart';
13 14
14 main() { 15 main() {
15 useCompactVMConfiguration(); 16 useCompactVMConfiguration();
16 17
17 // Run all initializers. 18 // Run all initializers.
18 run().then((_) { 19 run().then((_) {
19 test('annotations are seen in post-order with superclasses first', () { 20 test('annotations are seen in post-order with superclasses first', () {
20 var expectedNames = [ 21 var expectedNames = [
21 #initialize.test.foo, 22 const LibraryIdentifier(
23 #initialize_test_fixtures.bar, 'initialize_test_fixtures',
24 'bar.dart'),
25 const LibraryIdentifier(
26 #initialize_test_fixtures.foo, 'initialize_test_fixtures',
27 'foo.dart'),
28 const LibraryIdentifier(#initialize.test.foo, null, 'foo.dart'),
22 foo, 29 foo,
23 fooBar, 30 fooBar,
24 Foo, 31 Foo,
25 #initialize.test.bar, 32 const LibraryIdentifier(#initialize.test.bar, null, 'bar.dart'),
26 bar, 33 bar,
27 Bar, 34 Bar,
28 #initialize.initializer_test, 35 const LibraryIdentifier(
36 #initialize.initializer_test, null, 'initializer_test.dart'),
29 zap, 37 zap,
30 Zoop, // Zap extends Zoop, so Zoop comes first. 38 Zoop, // Zap extends Zoop, so Zoop comes first.
31 Zap 39 Zap
32 ]; 40 ];
33 expect(InitializeTracker.seen, expectedNames); 41 expect(InitializeTracker.seen, expectedNames);
34 }); 42 });
35 43
36 test('annotations only run once', () { 44 test('annotations only run once', () {
37 // Run the initializers again, should be a no-op. 45 // Run the initializers again, should be a no-op.
38 var originalSize = InitializeTracker.seen.length; 46 var originalSize = InitializeTracker.seen.length;
39 return run().then((_) { 47 return run().then((_) {
40 expect(InitializeTracker.seen.length, originalSize); 48 expect(InitializeTracker.seen.length, originalSize);
41 }); 49 });
42 }); 50 });
43 }); 51 });
44 } 52 }
45 53
46 @initializeTracker 54 @initializeTracker
47 class Zoop {} 55 class Zoop {}
48 56
49 @initializeTracker 57 @initializeTracker
50 class Zap extends Zoop {} 58 class Zap extends Zoop {}
51 59
52 @initializeTracker 60 @initializeTracker
53 zap() {} 61 zap() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698