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

Unified Diff: test/transformer_test.dart

Issue 973073003: fix a few issues around exported libraries (Closed) Base URL: git@github.com:dart-lang/static-init.git@master
Patch Set: use .path instead of .toString 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/transformer_test.dart
diff --git a/test/transformer_test.dart b/test/transformer_test.dart
index e90eefc2a93aba8d42848d2a61371c1673f7a065..dea15459f3bc1ed268ce71799758b5ce7429124a 100644
--- a/test/transformer_test.dart
+++ b/test/transformer_test.dart
@@ -193,6 +193,93 @@ void dartEntryPointTests() {
}
''')
}, []);
+
+ testPhases('exported library annotations', phases, {
+ 'a|web/index.dart': '''
+ library web_foo;
+
+ export 'foo.dart';
+ ''',
+ 'a|web/foo.dart': '''
+ @constInit
+ library foo;
+
+ import 'package:test_initializers/common.dart';
+
+ @constInit
+ foo() {};
+
+ @constInit
+ class Foo {}
+ ''',
+ // Mock out the Initialize package plus some initializers.
+ 'initialize|lib/initialize.dart': mockInitialize,
+ 'test_initializers|lib/common.dart': commonInitializers,
+ }, {
+ 'a|web/index.initialize.dart': formatter.format('''
+ import 'package:initialize/src/static_loader.dart';
+ import 'package:initialize/initialize.dart';
+ import 'index.dart' as i0;
+ import 'foo.dart' as i1;
+ import 'package:test_initializers/common.dart' as i2;
+
+ main() {
+ initializers.addAll([
+ new InitEntry(i2.constInit, const LibraryIdentifier(#foo, null, 'foo.dart')),
+ new InitEntry(i2.constInit, i1.foo),
+ new InitEntry(i2.constInit, i1.Foo),
+ ]);
+
+ i0.main();
+ }
+ ''')
+ }, []);
+
+ testPhases('imports from exported libraries', phases, {
+ 'a|web/index.dart': '''
+ library web_foo;
+
+ export 'foo.dart';
+ ''',
+ 'a|web/foo.dart': '''
+ library foo;
+
+ import 'bar.dart';
+ ''',
+ 'a|web/bar.dart': '''
+ @constInit
+ library bar;
+
+ import 'package:test_initializers/common.dart';
+
+ @constInit
+ bar() {};
+
+ @constInit
+ class Bar {}
+ ''',
+ // Mock out the Initialize package plus some initializers.
+ 'initialize|lib/initialize.dart': mockInitialize,
+ 'test_initializers|lib/common.dart': commonInitializers,
+ }, {
+ 'a|web/index.initialize.dart': formatter.format('''
+ import 'package:initialize/src/static_loader.dart';
+ import 'package:initialize/initialize.dart';
+ import 'index.dart' as i0;
+ import 'bar.dart' as i1;
+ import 'package:test_initializers/common.dart' as i2;
+
+ main() {
+ initializers.addAll([
+ new InitEntry(i2.constInit, const LibraryIdentifier(#bar, null, 'bar.dart')),
+ new InitEntry(i2.constInit, i1.bar),
+ new InitEntry(i2.constInit, i1.Bar),
+ ]);
+
+ i0.main();
+ }
+ ''')
+ }, []);
}
class SkipConstructorsPlugin extends InitializerPlugin {
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698