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 'dart:uri'; | 7 import 'dart:uri'; |
8 import 'parser_helper.dart'; | 8 import 'parser_helper.dart'; |
9 import 'mock_compiler.dart'; | 9 import 'mock_compiler.dart'; |
10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart'; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 testDart2DartWithLibrary( | 85 testDart2DartWithLibrary( |
86 String srcMain, String srcLibrary, | 86 String srcMain, String srcLibrary, |
87 {void continuation(String s), bool minify: false, | 87 {void continuation(String s), bool minify: false, |
88 bool stripTypes: false}) { | 88 bool stripTypes: false}) { |
89 fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path); | 89 fileUri(path) => new Uri.fromComponents(scheme: 'file', path: path); |
90 | 90 |
91 final scriptUri = fileUri('script.dart'); | 91 final scriptUri = fileUri('script.dart'); |
92 final libUri = fileUri('mylib.dart'); | 92 final libUri = fileUri('mylib.dart'); |
93 | 93 |
94 provider(uri) { | 94 provider(uri) { |
95 if (uri == scriptUri) return new Future.immediate(srcMain); | 95 if (uri == scriptUri) return new Future.value(srcMain); |
96 if (uri.toString() == libUri.toString()) { | 96 if (uri.toString() == libUri.toString()) { |
97 return new Future.immediate(srcLibrary); | 97 return new Future.value(srcLibrary); |
98 } | 98 } |
99 if (uri.path.endsWith('/core.dart')) { | 99 if (uri.path.endsWith('/core.dart')) { |
100 return new Future.immediate(coreLib); | 100 return new Future.value(coreLib); |
101 } else if (uri.path.endsWith('/io.dart')) { | 101 } else if (uri.path.endsWith('/io.dart')) { |
102 return new Future.immediate(ioLib); | 102 return new Future.value(ioLib); |
103 } else if (uri.path.endsWith('/js_helper.dart')) { | 103 } else if (uri.path.endsWith('/js_helper.dart')) { |
104 return new Future.immediate(helperLib); | 104 return new Future.value(helperLib); |
105 } else if (uri.path.endsWith('/html_dart2js.dart')) { | 105 } else if (uri.path.endsWith('/html_dart2js.dart')) { |
106 // TODO(smok): The file should change to html_dartium at some point. | 106 // TODO(smok): The file should change to html_dartium at some point. |
107 return new Future.immediate(htmlLib); | 107 return new Future.value(htmlLib); |
108 } else if (uri.path.endsWith('/foreign_helper.dart')) { | 108 } else if (uri.path.endsWith('/foreign_helper.dart')) { |
109 return new Future.immediate(foreignLib); | 109 return new Future.value(foreignLib); |
110 } else if (uri.path.endsWith('/isolate_helper.dart')) { | 110 } else if (uri.path.endsWith('/isolate_helper.dart')) { |
111 return new Future.immediate(isolateHelperLib); | 111 return new Future.value(isolateHelperLib); |
112 } | 112 } |
113 return new Future.immediate(''); | 113 return new Future.value(''); |
114 } | 114 } |
115 | 115 |
116 handler(uri, begin, end, message, kind) { | 116 handler(uri, begin, end, message, kind) { |
117 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH))
{ | 117 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH))
{ |
118 Expect.fail('$uri: $begin-$end: $message [$kind]'); | 118 Expect.fail('$uri: $begin-$end: $message [$kind]'); |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 final options = <String>['--output-type=dart']; | 122 final options = <String>['--output-type=dart']; |
123 // Some tests below are using dart:io. | 123 // Some tests below are using dart:io. |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 testStaticAccessIoLib(); | 756 testStaticAccessIoLib(); |
757 testLocalFunctionPlaceholder(); | 757 testLocalFunctionPlaceholder(); |
758 testMinification(); | 758 testMinification(); |
759 testClosureLocalsMinified(); | 759 testClosureLocalsMinified(); |
760 testParametersMinified(); | 760 testParametersMinified(); |
761 testDeclarationTypePlaceholders(); | 761 testDeclarationTypePlaceholders(); |
762 testPlatformLibraryMemberNamesAreFixed(); | 762 testPlatformLibraryMemberNamesAreFixed(); |
763 testConflictsWithCoreLib(); | 763 testConflictsWithCoreLib(); |
764 testUnresolvedNamedConstructor(); | 764 testUnresolvedNamedConstructor(); |
765 } | 765 } |
OLD | NEW |