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

Side by Side Diff: tests/utils/dummy_compiler_test.dart

Issue 16019002: Merge the dart:uri library into dart:core and update the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing files Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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 // Smoke test of the dart2js compiler API. 5 // Smoke test of the dart2js compiler API.
6 library dummy_compiler; 6 library dummy_compiler;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:uri';
10 9
11 import '../../sdk/lib/_internal/compiler/compiler.dart'; 10 import '../../sdk/lib/_internal/compiler/compiler.dart';
12 11
13 Future<String> provider(Uri uri) { 12 Future<String> provider(Uri uri) {
14 String source; 13 String source;
15 if (uri.scheme == "main") { 14 if (uri.scheme == "main") {
16 source = "main() {}"; 15 source = "main() {}";
17 } else if (uri.scheme == "lib") { 16 } else if (uri.scheme == "lib") {
18 if (uri.path.endsWith("/core.dart")) { 17 if (uri.path.endsWith("/core.dart")) {
19 source = """library core; 18 source = """library core;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { 85 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) {
87 if (uri == null) { 86 if (uri == null) {
88 print('$kind: $message'); 87 print('$kind: $message');
89 } else { 88 } else {
90 print('$uri:$begin:$end: $kind: $message'); 89 print('$uri:$begin:$end: $kind: $message');
91 } 90 }
92 } 91 }
93 92
94 main() { 93 main() {
95 Future<String> result = 94 Future<String> result =
96 compile(new Uri.fromComponents(scheme: 'main'), 95 compile(new Uri(scheme: 'main'),
97 new Uri.fromComponents(scheme: 'lib', path: '/'), 96 new Uri(scheme: 'lib', path: '/'),
98 new Uri.fromComponents(scheme: 'package', path: '/'), 97 new Uri(scheme: 'package', path: '/'),
99 provider, handler); 98 provider, handler);
100 result.then((String code) { 99 result.then((String code) {
101 if (code == null) { 100 if (code == null) {
102 throw 'Compilation failed'; 101 throw 'Compilation failed';
103 } 102 }
104 }, onError: (e) { 103 }, onError: (e) {
105 throw 'Compilation failed'; 104 throw 'Compilation failed';
106 }); 105 });
107 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698