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

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

Issue 339563002: Remove scanBuiltinLibraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 6 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 // Test of "recursive" imports using the dart2js compiler API. 5 // Test of "recursive" imports using the dart2js compiler API.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dummy_compiler_test.dart';
10 import '../../sdk/lib/_internal/compiler/compiler.dart'; 11 import '../../sdk/lib/_internal/compiler/compiler.dart';
11 12
12 const CORE_LIB = """
13 library core;
14 class Object {
15 const Object();
16 operator==(other) {}
17 }
18 class bool {}
19 class num {}
20 class int {}
21 class double{}
22 class String{}
23 class Function{}
24 class List {}
25 class Map {}
26 class BoundClosure {}
27 class Closure {}
28 class Dynamic_ {}
29 class Type {}
30 class Null {}
31 class StackTrace {}
32 class LinkedHashMap {}
33 getRuntimeTypeInfo(o) {}
34 setRuntimeTypeInfo(o, i) {}
35 eqNull(a) {}
36 eqNullB(a) {}
37 class JSInvocationMirror {} // Should be in helper.
38 class _Proxy { const _Proxy(); }
39 const proxy = const _Proxy();
40 """;
41
42 const INTERCEPTORS_LIB = """
43 library interceptors;
44 class JSIndexable {
45 get length {}
46 }
47 class JSMutableIndexable {}
48 class JSArray {
49 JSArray() {}
50 factory JSArray.typed(a) => a;
51 removeLast() => null;
52 add(x) { }
53 }
54 class JSMutableArray extends JSArray {}
55 class JSExtendableArray extends JSMutableArray {}
56 class JSFixedArray extends JSMutableArray {}
57 class JSString {
58 split(x) => null;
59 concat(x) => null;
60 toString() => null;
61 operator+(other) => null;
62 }
63 class JSNull {
64 bool operator ==(other) => identical(null, other);
65 int get hashCode => 0;
66 }
67 class JSBool {
68 }
69 """;
70
71 const String RECURSIVE_MAIN = """ 13 const String RECURSIVE_MAIN = """
72 library fisk; 14 library fisk;
73 import 'recurse/fisk.dart'; 15 import 'recurse/fisk.dart';
74 main() {} 16 main() {}
75 """; 17 """;
76 18
77 19
78 main() { 20 main() {
79 int count = 0; 21 int count = 0;
80 Future<String> provider(Uri uri) { 22 Future<String> provider(Uri uri) {
81 String source; 23 String source;
82 if (uri.path.length > 100) { 24 if (uri.path.length > 100) {
83 // Simulate an OS error. 25 // Simulate an OS error.
84 throw 'Path length exceeded'; 26 throw 'Path length exceeded';
85 } else if (uri.scheme == "main") { 27 } else if (uri.scheme == "main") {
86 count++; 28 count++;
87 source = RECURSIVE_MAIN; 29 source = RECURSIVE_MAIN;
88 } else if (uri.scheme == "lib") { 30 } else if (uri.scheme == "lib") {
89 if (uri.path.endsWith("/core.dart")) { 31 source = libProvider(uri);
90 source = CORE_LIB;
91 } else if (uri.path.endsWith('_patch.dart')) {
92 source = '';
93 } else if (uri.path.endsWith('isolate_helper.dart')) {
94 source = 'class _WorkerStub {}';
95 } else if (uri.path.endsWith('interceptors.dart')) {
96 source = INTERCEPTORS_LIB;
97 } else {
98 source = "library lib${uri.path.replaceAll('/', '.')};";
99 }
100 } else { 32 } else {
101 return new Future.error("unexpected URI $uri"); 33 return new Future.error("unexpected URI $uri");
102 } 34 }
103 return new Future.value(source); 35 return new Future.value(source);
104 } 36 }
105 37
106 int warningCount = 0; 38 int warningCount = 0;
107 int errorCount = 0; 39 int errorCount = 0;
108 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) { 40 void handler(Uri uri, int begin, int end, String message, Diagnostic kind) {
109 if (uri != null) { 41 if (uri != null) {
(...skipping 19 matching lines...) Expand all
129 Expect.isNull(code); 61 Expect.isNull(code);
130 Expect.isTrue(10 < count); 62 Expect.isTrue(10 < count);
131 // Two warnings for each time RECURSIVE_MAIN is read, except the 63 // Two warnings for each time RECURSIVE_MAIN is read, except the
132 // first time. 64 // first time.
133 Expect.equals(2 * (count - 1), warningCount); 65 Expect.equals(2 * (count - 1), warningCount);
134 Expect.equals(1, errorCount); 66 Expect.equals(1, errorCount);
135 }, onError: (e) { 67 }, onError: (e) {
136 throw 'Compilation failed'; 68 throw 'Compilation failed';
137 }).then(asyncSuccess); 69 }).then(asyncSuccess);
138 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698