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

Side by Side Diff: pkg/analysis_server/test/mock_sdk.dart

Issue 1310263003: Reformat code to minimize churn (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library testing.mock_sdk; 5 library testing.mock_sdk;
6 6
7 import 'package:analyzer/file_system/file_system.dart' as resource; 7 import 'package:analyzer/file_system/file_system.dart' as resource;
8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource;
9 import 'package:analyzer/src/context/context.dart' as newContext; 9 import 'package:analyzer/src/context/context.dart' as newContext;
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/generated/sdk.dart'; 11 import 'package:analyzer/src/generated/sdk.dart';
12 import 'package:analyzer/src/generated/source.dart'; 12 import 'package:analyzer/src/generated/source.dart';
13 13
14 class MockSdk implements DartSdk { 14 class MockSdk implements DartSdk {
15 static const _MockSdkLibrary LIB_CORE = const _MockSdkLibrary('dart:core', 15 static const _MockSdkLibrary LIB_CORE = const _MockSdkLibrary(
16 '/lib/core/core.dart', ''' 16 'dart:core',
17 '/lib/core/core.dart',
18 '''
17 library dart.core; 19 library dart.core;
18 20
19 import 'dart:async'; 21 import 'dart:async';
20 import 'dart:_internal'; 22 import 'dart:_internal';
21 23
22 class Object { 24 class Object {
23 bool operator ==(other) => identical(this, other); 25 bool operator ==(other) => identical(this, other);
24 String toString() => 'a string'; 26 String toString() => 'a string';
25 int get hashCode => 0; 27 int get hashCode => 0;
26 } 28 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 class Uri { 107 class Uri {
106 static List<int> parseIPv6Address(String host, [int start = 0, int end]) { 108 static List<int> parseIPv6Address(String host, [int start = 0, int end]) {
107 int parseHex(int start, int end) { 109 int parseHex(int start, int end) {
108 return 0; 110 return 0;
109 } 111 }
110 return null; 112 return null;
111 } 113 }
112 } 114 }
113 '''); 115 ''');
114 116
115 static const _MockSdkLibrary LIB_ASYNC = const _MockSdkLibrary('dart:async', 117 static const _MockSdkLibrary LIB_ASYNC = const _MockSdkLibrary(
116 '/lib/async/async.dart', ''' 118 'dart:async',
119 '/lib/async/async.dart',
120 '''
117 library dart.async; 121 library dart.async;
118 122
119 import 'dart:math'; 123 import 'dart:math';
120 124
121 class Future<T> { 125 class Future<T> {
122 factory Future(computation()) => null; 126 factory Future(computation()) => null;
123 factory Future.delayed(Duration duration, [T computation()]) => null; 127 factory Future.delayed(Duration duration, [T computation()]) => null;
124 factory Future.value([value]) => null; 128 factory Future.value([value]) => null;
125 static Future wait(List<Future> futures) => null; 129 static Future wait(List<Future> futures) => null;
126 } 130 }
127 131
128 class Stream<T> {} 132 class Stream<T> {}
129 abstract class StreamTransformer<S, T> {} 133 abstract class StreamTransformer<S, T> {}
130 '''); 134 ''');
131 135
132 static const _MockSdkLibrary LIB_COLLECTION = const _MockSdkLibrary( 136 static const _MockSdkLibrary LIB_COLLECTION = const _MockSdkLibrary(
133 'dart:collection', '/lib/collection/collection.dart', ''' 137 'dart:collection',
138 '/lib/collection/collection.dart',
139 '''
134 library dart.collection; 140 library dart.collection;
135 141
136 abstract class HashMap<K, V> implements Map<K, V> {} 142 abstract class HashMap<K, V> implements Map<K, V> {}
137 '''); 143 ''');
138 144
139 static const _MockSdkLibrary LIB_CONVERT = const _MockSdkLibrary( 145 static const _MockSdkLibrary LIB_CONVERT = const _MockSdkLibrary(
140 'dart:convert', '/lib/convert/convert.dart', ''' 146 'dart:convert',
147 '/lib/convert/convert.dart',
148 '''
141 library dart.convert; 149 library dart.convert;
142 150
143 import 'dart:async'; 151 import 'dart:async';
144 152
145 abstract class Converter<S, T> implements StreamTransformer {} 153 abstract class Converter<S, T> implements StreamTransformer {}
146 class JsonDecoder extends Converter<String, Object> {} 154 class JsonDecoder extends Converter<String, Object> {}
147 '''); 155 ''');
148 156
149 static const _MockSdkLibrary LIB_MATH = const _MockSdkLibrary('dart:math', 157 static const _MockSdkLibrary LIB_MATH = const _MockSdkLibrary(
150 '/lib/math/math.dart', ''' 158 'dart:math',
159 '/lib/math/math.dart',
160 '''
151 library dart.math; 161 library dart.math;
152 const double E = 2.718281828459045; 162 const double E = 2.718281828459045;
153 const double PI = 3.1415926535897932; 163 const double PI = 3.1415926535897932;
154 const double LN10 = 2.302585092994046; 164 const double LN10 = 2.302585092994046;
155 num min(num a, num b) => 0; 165 num min(num a, num b) => 0;
156 num max(num a, num b) => 0; 166 num max(num a, num b) => 0;
157 external double cos(num x); 167 external double cos(num x);
158 external num pow(num x, num exponent); 168 external num pow(num x, num exponent);
159 external double sin(num x); 169 external double sin(num x);
160 external double sqrt(num x); 170 external double sqrt(num x);
161 class Random { 171 class Random {
162 bool nextBool() => true; 172 bool nextBool() => true;
163 double nextDouble() => 2.0; 173 double nextDouble() => 2.0;
164 int nextInt() => 1; 174 int nextInt() => 1;
165 } 175 }
166 '''); 176 ''');
167 177
168 static const _MockSdkLibrary LIB_HTML = const _MockSdkLibrary('dart:html', 178 static const _MockSdkLibrary LIB_HTML = const _MockSdkLibrary(
169 '/lib/html/dartium/html_dartium.dart', ''' 179 'dart:html',
180 '/lib/html/dartium/html_dartium.dart',
181 '''
170 library dart.html; 182 library dart.html;
171 class HtmlElement {} 183 class HtmlElement {}
172 '''); 184 ''');
173 185
174 static const _MockSdkLibrary LIB_INTERNAL = const _MockSdkLibrary( 186 static const _MockSdkLibrary LIB_INTERNAL = const _MockSdkLibrary(
175 'dart:_internal', '/lib/internal/internal.dart', ''' 187 'dart:_internal',
188 '/lib/internal/internal.dart',
189 '''
176 library dart._internal; 190 library dart._internal;
177 external void printToConsole(String line); 191 external void printToConsole(String line);
178 '''); 192 ''');
179 193
180 static const List<SdkLibrary> LIBRARIES = const [ 194 static const List<SdkLibrary> LIBRARIES = const [
181 LIB_CORE, 195 LIB_CORE,
182 LIB_ASYNC, 196 LIB_ASYNC,
183 LIB_COLLECTION, 197 LIB_COLLECTION,
184 LIB_CONVERT, 198 LIB_CONVERT,
185 LIB_MATH, 199 LIB_MATH,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool get isInternal => shortName.startsWith('dart:_'); 341 bool get isInternal => shortName.startsWith('dart:_');
328 342
329 @override 343 @override
330 bool get isShared => throw unimplemented; 344 bool get isShared => throw unimplemented;
331 345
332 @override 346 @override
333 bool get isVmLibrary => throw unimplemented; 347 bool get isVmLibrary => throw unimplemented;
334 348
335 UnimplementedError get unimplemented => new UnimplementedError(); 349 UnimplementedError get unimplemented => new UnimplementedError();
336 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698