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

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

Issue 11308227: Fix problems due to unit testing of the compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 6
7 import '../../sdk/lib/_internal/compiler/compiler.dart'; 7 import '../../sdk/lib/_internal/compiler/compiler.dart';
8 import 'dart:uri'; 8 import 'dart:uri';
9 9
10 Future<String> provider(Uri uri) { 10 Future<String> provider(Uri uri) {
(...skipping 16 matching lines...) Expand all
27 class Map {} 27 class Map {}
28 class Closure {} 28 class Closure {}
29 class Dynamic_ {} 29 class Dynamic_ {}
30 class Null {} 30 class Null {}
31 getRuntimeTypeInfo(o) {} 31 getRuntimeTypeInfo(o) {}
32 setRuntimeTypeInfo(o, i) {} 32 setRuntimeTypeInfo(o, i) {}
33 eqNull(a) {} 33 eqNull(a) {}
34 eqNullB(a) {}"""; 34 eqNullB(a) {}""";
35 } else if (uri.path.endsWith('_patch.dart')) { 35 } else if (uri.path.endsWith('_patch.dart')) {
36 source = ''; 36 source = '';
37 } else if (uri.path.endsWith('interceptors.dart')) {
ahe 2012/11/28 11:17:36 Should be '/interceptors.dart', I think.
ngeoffray 2012/11/28 11:42:03 The other uri.path checks don't use '/'. Why would
ahe 2012/11/28 12:26:21 The one on line 35 doesn't because it is matching
38 source = """class ObjectInterceptor {}
39 var getInterceptor;""";
37 } else if (uri.path.endsWith('js_helper.dart')) { 40 } else if (uri.path.endsWith('js_helper.dart')) {
38 source = 'library jshelper; class JSInvocationMirror {}'; 41 source = 'library jshelper; class JSInvocationMirror {}';
39 } else { 42 } else {
40 source = "#library('lib');"; 43 source = "#library('lib');";
41 } 44 }
42 } else { 45 } else {
43 throw "unexpected URI $uri"; 46 throw "unexpected URI $uri";
44 } 47 }
45 completer.complete(source); 48 completer.complete(source);
46 return completer.future; 49 return completer.future;
47 } 50 }
48 51
49 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { 52 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) {
50 if (uri == null) { 53 if (uri == null) {
51 print('$kind: $message'); 54 print('$kind: $message');
52 } else { 55 } else {
53 print('$uri:$begin:$end: $kind: $message'); 56 print('$uri:$begin:$end: $kind: $message');
54 } 57 }
55 } 58 }
56 59
57 main() { 60 main() {
58 String code = compile(new Uri.fromComponents(scheme: 'main'), 61 String code = compile(new Uri.fromComponents(scheme: 'main'),
59 new Uri.fromComponents(scheme: 'lib', path: '/'), 62 new Uri.fromComponents(scheme: 'lib', path: '/'),
60 new Uri.fromComponents(scheme: 'package', path: '/'), 63 new Uri.fromComponents(scheme: 'package', path: '/'),
61 provider, handler).value; 64 provider, handler).value;
62 if (code == null) { 65 if (code == null) {
63 throw 'Compilation failed'; 66 throw 'Compilation failed';
64 } 67 }
65 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698