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

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: code review updates Created 5 years, 10 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
« no previous file with comments | « test/initializer_custom_filter_test.dart ('k') | test/transformer_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:test_package/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(#test_package.bar, 'test_package', 'bar.dart'),
23 const LibraryIdentifier(#test_package.foo, 'test_package','foo.dart'),
24 const LibraryIdentifier(#initialize.test.foo, null, 'foo.dart'),
22 foo, 25 foo,
23 fooBar, 26 fooBar,
24 Foo, 27 Foo,
25 #initialize.test.bar, 28 const LibraryIdentifier(#initialize.test.bar, null, 'bar.dart'),
26 bar, 29 bar,
27 Bar, 30 Bar,
28 #initialize.initializer_test, 31 const LibraryIdentifier(
32 #initialize.initializer_test, null, 'initializer_test.dart'),
29 zap, 33 zap,
30 Zoop, // Zap extends Zoop, so Zoop comes first. 34 Zoop, // Zap extends Zoop, so Zoop comes first.
31 Zap 35 Zap
32 ]; 36 ];
33 expect(InitializeTracker.seen, expectedNames); 37 expect(InitializeTracker.seen, expectedNames);
34 }); 38 });
35 39
36 test('annotations only run once', () { 40 test('annotations only run once', () {
37 // Run the initializers again, should be a no-op. 41 // Run the initializers again, should be a no-op.
38 var originalSize = InitializeTracker.seen.length; 42 var originalSize = InitializeTracker.seen.length;
39 return run().then((_) { 43 return run().then((_) {
40 expect(InitializeTracker.seen.length, originalSize); 44 expect(InitializeTracker.seen.length, originalSize);
41 }); 45 });
42 }); 46 });
43 }); 47 });
44 } 48 }
45 49
46 @initializeTracker 50 @initializeTracker
47 class Zoop {} 51 class Zoop {}
48 52
49 @initializeTracker 53 @initializeTracker
50 class Zap extends Zoop {} 54 class Zap extends Zoop {}
51 55
52 @initializeTracker 56 @initializeTracker
53 zap() {} 57 zap() {}
OLDNEW
« no previous file with comments | « test/initializer_custom_filter_test.dart ('k') | test/transformer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698