| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 import '../mock_compiler.dart'; | 8 import '../mock_compiler.dart'; |
| 9 import '../mock_libraries.dart'; | 9 import '../mock_libraries.dart'; |
| 10 import '../output_collector.dart'; |
| 10 import 'package:compiler/compiler.dart'; | 11 import 'package:compiler/compiler.dart'; |
| 11 import 'package:compiler/src/dart2jslib.dart' as leg; | 12 import 'package:compiler/src/dart2jslib.dart' as leg; |
| 12 import 'package:compiler/src/dart_backend/dart_backend.dart'; | 13 import 'package:compiler/src/dart_backend/dart_backend.dart'; |
| 13 import 'package:compiler/src/elements/elements.dart'; | 14 import 'package:compiler/src/elements/elements.dart'; |
| 14 import 'package:compiler/src/tree/tree.dart'; | 15 import 'package:compiler/src/tree/tree.dart'; |
| 15 | 16 |
| 16 const ioLib = r''' | 17 const ioLib = r''' |
| 17 library io; | 18 library io; |
| 18 class Platform { | 19 class Platform { |
| 19 static int operatingSystem; | 20 static int operatingSystem; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 85 } |
| 85 } | 86 } |
| 86 | 87 |
| 87 final options = <String>['--output-type=dart']; | 88 final options = <String>['--output-type=dart']; |
| 88 // Some tests below are using dart:io. | 89 // Some tests below are using dart:io. |
| 89 options.add('--categories=Client,Server'); | 90 options.add('--categories=Client,Server'); |
| 90 if (minify) options.add('--minify'); | 91 if (minify) options.add('--minify'); |
| 91 if (stripTypes) options.add('--force-strip=types'); | 92 if (stripTypes) options.add('--force-strip=types'); |
| 92 | 93 |
| 93 asyncTest(() { | 94 asyncTest(() { |
| 95 OutputCollector outputCollector = new OutputCollector(); |
| 94 return compile( | 96 return compile( |
| 95 scriptUri, | 97 scriptUri, |
| 96 fileUri('libraryRoot/'), | 98 fileUri('libraryRoot/'), |
| 97 fileUri('packageRoot/'), | 99 fileUri('packageRoot/'), |
| 98 provider, | 100 provider, |
| 99 handler, | 101 handler, |
| 100 options).then((s) { | 102 options, |
| 101 Expect.equals(expectedResult, s, | 103 outputCollector).then((_) { |
| 102 'expected:\n$expectedResult\nactual:\n$s'); | 104 String code = outputCollector.getOutput('', 'dart'); |
| 105 Expect.equals(expectedResult, code, |
| 106 'expected:\n$expectedResult\nactual:\n$code'); |
| 103 }); | 107 }); |
| 104 }); | 108 }); |
| 105 } | 109 } |
| 106 | 110 |
| 107 testSimpleFileUnparse() { | 111 testSimpleFileUnparse() { |
| 108 final src = ''' | 112 final src = ''' |
| 109 should_be_dropped() { | 113 should_be_dropped() { |
| 110 } | 114 } |
| 111 | 115 |
| 112 should_be_kept() { | 116 should_be_kept() { |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 testParametersMinified(); | 1107 testParametersMinified(); |
| 1104 testDeclarationTypePlaceholders(); | 1108 testDeclarationTypePlaceholders(); |
| 1105 testPlatformLibraryMemberNamesAreFixed(); | 1109 testPlatformLibraryMemberNamesAreFixed(); |
| 1106 testConflictsWithCoreLib(); | 1110 testConflictsWithCoreLib(); |
| 1107 testUnresolvedNamedConstructor1(); | 1111 testUnresolvedNamedConstructor1(); |
| 1108 testUnresolvedNamedConstructor2(); | 1112 testUnresolvedNamedConstructor2(); |
| 1109 testUnresolvedNamedConstructor3(); | 1113 testUnresolvedNamedConstructor3(); |
| 1110 testClassAndNamedMixinDeclarations(); | 1114 testClassAndNamedMixinDeclarations(); |
| 1111 } | 1115 } |
| 1112 | 1116 |
| OLD | NEW |