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

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

Issue 10891004: [dart2dart] Optionally cut types in variable declarations: (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 7eda5fdf597507cde94d9f58b6f028c84d837603..8fddf2647caef38de964da3c7afe713f1f7a1390 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -9,6 +9,7 @@
#import("../../../lib/compiler/implementation/leg.dart", prefix:'leg');
#import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart");
#import("../../../lib/compiler/implementation/elements/elements.dart");
+#import("../../../lib/compiler/implementation/scanner/scannerlib.dart");
Anton Muhin 2012/08/28 13:39:45 why?
Roman 2012/08/28 14:48:55 Thanks, now obsolete.
#import("../../../lib/compiler/implementation/tree/tree.dart");
testUnparse(String statement) {
@@ -47,12 +48,13 @@ class Platform {
}
''';
-testDart2Dart(String src, [void continuation(String s), bool minify = false]) {
+testDart2Dart(String src, [void continuation(String s), bool minify = false,
+ bool cutDeclarationTypes = false]) {
// If continuation is not provided, check that source string remains the same.
if (continuation === null) {
continuation = (s) { Expect.equals(src, s); };
}
- testDart2DartWithLibrary(src, '', continuation, minify);
+ testDart2DartWithLibrary(src, '', continuation, minify, cutDeclarationTypes);
}
/**
@@ -60,7 +62,8 @@ testDart2Dart(String src, [void continuation(String s), bool minify = false]) {
*/
testDart2DartWithLibrary(
String srcMain, String srcLibrary,
- [void continuation(String s), bool minify = false]) {
+ [void continuation(String s), bool minify = false,
+ bool cutDeclarationTypes = false]) {
fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path);
final scriptUri = fileUri('script.dart');
@@ -84,6 +87,7 @@ testDart2DartWithLibrary(
final options = <String>['--output-type=dart'];
if (minify) options.add('--minify');
+ if (cutDeclarationTypes) options.add('--cutDeclarationTypes');
compile(
scriptUri,
@@ -781,6 +785,25 @@ main() {
(String result) { Expect.equals(expectedResult, result); });
}
+testDeclarationTypePlaceholders() {
+ var src = '''
+String globalfield;
+const String globalconstfield;
+
+void foo(String arg) {}
+
+main() {
+ String localvar;
+ foo("5");
+}
+''';
+ var expectedResult =
+ ' foo( arg){}main(){var localvar; foo("5");}';
+ testDart2Dart(src,
+ (String result) { Expect.equals(expectedResult, result); },
+ cutDeclarationTypes: true);
+}
+
main() {
testSignedConstants();
testGenericTypes();
@@ -822,4 +845,5 @@ main() {
testClosureLocalsMinified();
testParametersMinified();
testTypeVariablesInDifferentLibraries();
+ testDeclarationTypePlaceholders();
}
« 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