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

Unified Diff: tests/compiler/dart2js/unparser_test.dart

Issue 10868020: [dart2dart] In renamer only add import prefix for top-level elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « lib/compiler/implementation/dart_backend/renamer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/unparser_test.dart
diff --git a/tests/compiler/dart2js/unparser_test.dart b/tests/compiler/dart2js/unparser_test.dart
index 8c063823beacd7332b7328e19f6638d4bf0a0d8e..f031d003b937b5f7c8bd23b03a6918bcb1c0f577 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -39,6 +39,13 @@ class Math {
}
''';
+final ioLib = @'''
+#library('io');
+class Platform {
+ static int operatingSystem;
+}
+''';
+
testDart2Dart(String src, [void continuation(String s)]) {
// If continuation is not provided, check that source string remains the same.
if (continuation === null) {
@@ -63,6 +70,7 @@ testDart2DartWithLibrary(
return new Future.immediate(srcLibrary);
}
if (uri.path.endsWith('/core.dart')) return new Future.immediate(coreLib);
+ if (uri.path.endsWith('/io.dart')) return new Future.immediate(ioLib);
return new Future.immediate('');
}
@@ -630,6 +638,20 @@ main() {
(String result) { Expect.equals(expectedResult, result); });
}
+testStaticAccessIoLib() {
+ var src = '''
+#import('dart:io');
+
+main() {
+ Platform.operatingSystem;
+}
+''';
+ var expectedResult = '#import("dart:io", prefix: "p");'
+ 'main(){p.Platform.operatingSystem;}';
+ testDart2Dart(src,
+ (String result) { Expect.equals(expectedResult, result); });
+}
+
main() {
testSignedConstants();
testGenericTypes();
@@ -665,4 +687,5 @@ main() {
testClassTypeArgumentBound();
testDoubleMains();
testInterfaceDefaultAnotherLib();
+ testStaticAccessIoLib();
}
« no previous file with comments | « lib/compiler/implementation/dart_backend/renamer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698