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

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

Issue 12382012: Continue the crazy hacking on the recursive_import_test and give (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Test of "recursive" imports using the dart2js compiler API. 5 // Test of "recursive" imports using the dart2js compiler API.
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import '../../sdk/lib/_internal/compiler/compiler.dart'; 8 import '../../sdk/lib/_internal/compiler/compiler.dart';
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
(...skipping 13 matching lines...) Expand all
24 class Type {} 24 class Type {}
25 class Null {} 25 class Null {}
26 class LinkedHashMap {} 26 class LinkedHashMap {}
27 getRuntimeTypeInfo(o) {} 27 getRuntimeTypeInfo(o) {}
28 setRuntimeTypeInfo(o, i) {} 28 setRuntimeTypeInfo(o, i) {}
29 eqNull(a) {} 29 eqNull(a) {}
30 eqNullB(a) {} 30 eqNullB(a) {}
31 class JSInvocationMirror {} // Should be in helper. 31 class JSInvocationMirror {} // Should be in helper.
32 """; 32 """;
33 33
34 const INTERCEPTORS_LIB = """
35 library interceptors;
36 class JSArray {
37 get length => null;
38 removeLast() => null;
39 add(x) { }
40 }
41 class JSString {
42 get length => null;
43 split(x) => null;
44 concat(x) => null;
45 toString() => null;
46 }
47 """;
48
34 const String RECURSIVE_MAIN = """ 49 const String RECURSIVE_MAIN = """
35 library fisk; 50 library fisk;
36 import 'recurse/fisk.dart'; 51 import 'recurse/fisk.dart';
37 main() {} 52 main() {}
38 """; 53 """;
39 54
40 55
41 main() { 56 main() {
42 int count = 0; 57 int count = 0;
43 Future<String> provider(Uri uri) { 58 Future<String> provider(Uri uri) {
44 Completer<String> completer = new Completer<String>(); 59 Completer<String> completer = new Completer<String>();
45 String source; 60 String source;
46 if (uri.path.length > 100) { 61 if (uri.path.length > 100) {
47 // Simulate an OS error. 62 // Simulate an OS error.
48 throw 'Path length exceeded'; 63 throw 'Path length exceeded';
49 } else if (uri.scheme == "main") { 64 } else if (uri.scheme == "main") {
50 count++; 65 count++;
51 source = RECURSIVE_MAIN; 66 source = RECURSIVE_MAIN;
52 } else if (uri.scheme == "lib") { 67 } else if (uri.scheme == "lib") {
53 if (uri.path.endsWith("/core.dart")) { 68 if (uri.path.endsWith("/core.dart")) {
54 source = CORE_LIB; 69 source = CORE_LIB;
55 } else if (uri.path.endsWith('_patch.dart')) { 70 } else if (uri.path.endsWith('_patch.dart')) {
56 source = ''; 71 source = '';
57 } else if (uri.path.endsWith('isolate_helper.dart')) { 72 } else if (uri.path.endsWith('isolate_helper.dart')) {
58 source = 'class _WorkerStub {}'; 73 source = 'class _WorkerStub {}';
74 } else if (uri.path.endsWith('interceptors.dart')) {
75 source = INTERCEPTORS_LIB;
59 } else { 76 } else {
60 source = "library lib${uri.path.replaceAll('/', '.')};"; 77 source = "library lib${uri.path.replaceAll('/', '.')};";
61 } 78 }
62 } else { 79 } else {
63 throw "unexpected URI $uri"; 80 throw "unexpected URI $uri";
64 } 81 }
65 completer.complete(source); 82 completer.complete(source);
66 return completer.future; 83 return completer.future;
67 } 84 }
68 85
(...skipping 22 matching lines...) Expand all
91 Expect.isNull(code); 108 Expect.isNull(code);
92 Expect.isTrue(10 < count); 109 Expect.isTrue(10 < count);
93 // Two warnings for each time RECURSIVE_MAIN is read, except the 110 // Two warnings for each time RECURSIVE_MAIN is read, except the
94 // first time. 111 // first time.
95 Expect.equals(2 * (count - 1), warningCount); 112 Expect.equals(2 * (count - 1), warningCount);
96 Expect.equals(1, errorCount); 113 Expect.equals(1, errorCount);
97 }, onError: (AsyncError e) { 114 }, onError: (AsyncError e) {
98 throw 'Compilation failed'; 115 throw 'Compilation failed';
99 }); 116 });
100 } 117 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698