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

Side by Side Diff: tests/compiler/dart2js/backend_dart/dart_backend_test.dart

Issue 1408253006: Introduce "platform configurations" to replace categories and libraries.dart. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix create_sdk scripts according to review Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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:io' as io;
7 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
8 import '../mock_compiler.dart'; 9 import '../mock_compiler.dart';
9 import '../mock_libraries.dart'; 10 import '../mock_libraries.dart';
10 import '../output_collector.dart'; 11 import '../output_collector.dart';
11 import 'package:compiler/compiler.dart'; 12 import 'package:compiler/compiler.dart';
12 import 'package:compiler/src/common/names.dart' show Identifiers; 13 import 'package:compiler/src/common/names.dart' show Identifiers;
13 import 'package:compiler/src/dart_backend/dart_backend.dart'; 14 import 'package:compiler/src/dart_backend/dart_backend.dart';
14 import 'package:compiler/src/elements/elements.dart'; 15 import 'package:compiler/src/elements/elements.dart';
15 import 'package:compiler/src/tree/tree.dart'; 16 import 'package:compiler/src/tree/tree.dart';
16 17
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 fileUri(path) => new Uri(scheme: 'file', path: path); 52 fileUri(path) => new Uri(scheme: 'file', path: path);
52 53
53 final scriptUri = fileUri('script.dart'); 54 final scriptUri = fileUri('script.dart');
54 final libUri = fileUri('mylib.dart'); 55 final libUri = fileUri('mylib.dart');
55 56
56 provider(uri) { 57 provider(uri) {
57 if (uri == scriptUri) return new Future.value(mainSrc); 58 if (uri == scriptUri) return new Future.value(mainSrc);
58 if (uri.toString() == libUri.toString()) { 59 if (uri.toString() == libUri.toString()) {
59 return new Future.value(librarySrc); 60 return new Future.value(librarySrc);
60 } 61 }
61 if (uri.path.endsWith('/core.dart')) { 62 if (uri.path.endsWith('/dart2dart.platform')) {
63 return new io.File.fromUri(uri).readAsBytes();
64 } else if (uri.path.endsWith('/core.dart')) {
62 return new Future.value(buildLibrarySource(DEFAULT_CORE_LIBRARY)); 65 return new Future.value(buildLibrarySource(DEFAULT_CORE_LIBRARY));
63 } else if (uri.path.endsWith('/core_patch.dart')) { 66 } else if (uri.path.endsWith('/core_patch.dart')) {
64 return new Future.value(DEFAULT_PATCH_CORE_SOURCE); 67 return new Future.value(DEFAULT_PATCH_CORE_SOURCE);
65 } else if (uri.path.endsWith('/io.dart')) { 68 } else if (uri.path.endsWith('/io.dart')) {
66 return new Future.value(ioLib); 69 return new Future.value(ioLib);
67 } else if (uri.path.endsWith('/js_helper.dart')) { 70 } else if (uri.path.endsWith('/js_helper.dart')) {
68 return new Future.value(buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); 71 return new Future.value(buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY));
69 } else if (uri.path.endsWith('/html_dart2js.dart')) { 72 } else if (uri.path.endsWith('/html_dart2js.dart')) {
70 // TODO(smok): The file should change to html_dartium at some point. 73 // TODO(smok): The file should change to html_dartium at some point.
71 return new Future.value(htmlLib); 74 return new Future.value(htmlLib);
72 } else if (uri.path.endsWith('/foreign_helper.dart')) { 75 } else if (uri.path.endsWith('/foreign_helper.dart')) {
73 return new Future.value( 76 return new Future.value(
74 buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY)); 77 buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY));
75 } else if (uri.path.endsWith('/isolate_helper.dart')) { 78 } else if (uri.path.endsWith('/isolate_helper.dart')) {
76 return new Future.value( 79 return new Future.value(
77 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY)); 80 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY));
78 } 81 }
79 return new Future.value(''); 82 return new Future.value('');
80 } 83 }
81 84
82 handler(uri, begin, end, message, kind) { 85 handler(uri, begin, end, message, kind) {
83 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH)) { 86 if (identical(kind, Diagnostic.ERROR) || identical(kind, Diagnostic.CRASH)) {
84 Expect.fail('$uri: $begin-$end: $message [$kind]'); 87 Expect.fail('$uri: $begin-$end: $message [$kind]');
85 } 88 }
86 } 89 }
87 90
88 final options = <String>['--output-type=dart']; 91 final options = <String>['--output-type=dart'];
89 // Some tests below are using dart:io. 92 // Some tests below are using dart:io.
90 options.add('--categories=Client,Server');
91 if (minify) options.add('--minify'); 93 if (minify) options.add('--minify');
92 if (stripTypes) options.add('--force-strip=types'); 94 if (stripTypes) options.add('--force-strip=types');
93 95
94 asyncTest(() { 96 asyncTest(() {
95 OutputCollector outputCollector = new OutputCollector(); 97 OutputCollector outputCollector = new OutputCollector();
96 return compile( 98 return compile(
97 scriptUri, 99 scriptUri,
98 fileUri('libraryRoot/'), 100 Uri.base.resolve('sdk/'),
99 fileUri('packageRoot/'), 101 fileUri('packageRoot/'),
100 provider, 102 provider,
101 handler, 103 handler,
102 options, 104 options,
103 outputCollector).then((_) { 105 outputCollector).then((_) {
104 String code = outputCollector.getOutput('', 'dart'); 106 String code = outputCollector.getOutput('', 'dart');
105 Expect.equals(expectedResult, code, 107 Expect.equals(expectedResult, code,
106 'expected:\n$expectedResult\nactual:\n$code'); 108 'expected:\n$expectedResult\nactual:\n$code');
107 }); 109 });
108 }); 110 });
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 testParametersMinified(); 1110 testParametersMinified();
1109 testDeclarationTypePlaceholders(); 1111 testDeclarationTypePlaceholders();
1110 testPlatformLibraryMemberNamesAreFixed(); 1112 testPlatformLibraryMemberNamesAreFixed();
1111 testConflictsWithCoreLib(); 1113 testConflictsWithCoreLib();
1112 testUnresolvedNamedConstructor1(); 1114 testUnresolvedNamedConstructor1();
1113 testUnresolvedNamedConstructor2(); 1115 testUnresolvedNamedConstructor2();
1114 testUnresolvedNamedConstructor3(); 1116 testUnresolvedNamedConstructor3();
1115 testClassAndNamedMixinDeclarations(); 1117 testClassAndNamedMixinDeclarations();
1116 } 1118 }
1117 1119
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/analyze_only_test.dart ('k') | tests/compiler/dart2js/categories_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698