Chromium Code Reviews| 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(); |
| } |