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

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..d210f5f409bae783bbadbf1aef59c86211de8edb 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -47,12 +47,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 +61,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 +86,7 @@ testDart2DartWithLibrary(
final options = <String>['--output-type=dart'];
if (minify) options.add('--minify');
+ if (cutDeclarationTypes) options.add('--cutDeclarationTypes');
compile(
scriptUri,
@@ -781,6 +784,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 +844,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