OLD | NEW |
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 for creating mock versions of platform and internal libraries. | 5 // Library for creating mock versions of platform and internal libraries. |
6 | 6 |
7 library mock_libraries; | 7 library mock_libraries; |
8 | 8 |
9 String buildLibrarySource( | 9 String buildLibrarySource( |
10 Map<String, String> elementMap, | 10 Map<String, String> elementMap, |
(...skipping 27 matching lines...) Expand all Loading... |
38 abstract class double extends num { | 38 abstract class double extends num { |
39 static var NAN = 0; | 39 static var NAN = 0; |
40 static parse(s) {} | 40 static parse(s) {} |
41 }''', | 41 }''', |
42 'Function': r''' | 42 'Function': r''' |
43 class Function { | 43 class Function { |
44 static apply(Function fn, List positional, [Map named]) => null; | 44 static apply(Function fn, List positional, [Map named]) => null; |
45 }''', | 45 }''', |
46 'identical': 'bool identical(Object a, Object b) { return true; }', | 46 'identical': 'bool identical(Object a, Object b) { return true; }', |
47 'int': 'abstract class int extends num { }', | 47 'int': 'abstract class int extends num { }', |
48 'Iterable': 'abstract class Iterable {}', | 48 'Iterable': ''' |
| 49 abstract class Iterable<E> { |
| 50 Iterator<E> get iterator => null; |
| 51 }''', |
| 52 'Iterator': ''' |
| 53 abstract class Iterator<E> { |
| 54 E get current => null; |
| 55 }''', |
49 'LinkedHashMap': r''' | 56 'LinkedHashMap': r''' |
50 class LinkedHashMap { | 57 class LinkedHashMap { |
51 factory LinkedHashMap._empty() => null; | 58 factory LinkedHashMap._empty() => null; |
52 factory LinkedHashMap._literal(elements) => null; | 59 factory LinkedHashMap._literal(elements) => null; |
53 static _makeEmpty() => null; | 60 static _makeEmpty() => null; |
54 static _makeLiteral(elements) => null; | 61 static _makeLiteral(elements) => null; |
55 }''', | 62 }''', |
56 'List': r''' | 63 'List': r''' |
57 class List<E> { | 64 class List<E> extends Iterable<E> { |
58 var length; | 65 var length; |
59 List([length]); | 66 List([length]); |
60 List.filled(length, element); | 67 List.filled(length, element); |
61 E get first => null; | 68 E get first => null; |
62 E get last => null; | 69 E get last => null; |
63 E get single => null; | 70 E get single => null; |
64 E removeLast() => null; | 71 E removeLast() => null; |
65 E removeAt(i) => null; | 72 E removeAt(i) => null; |
66 E elementAt(i) => null; | 73 E elementAt(i) => null; |
67 E singleWhere(f) => null; | 74 E singleWhere(f) => null; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 operator[]=(index, value) { this[index] = value; } | 286 operator[]=(index, value) { this[index] = value; } |
280 add(value) { this[length + 1] = value; } | 287 add(value) { this[length + 1] = value; } |
281 insert(index, value) {} | 288 insert(index, value) {} |
282 E get first => this[0]; | 289 E get first => this[0]; |
283 E get last => this[0]; | 290 E get last => this[0]; |
284 E get single => this[0]; | 291 E get single => this[0]; |
285 E removeLast() => this[0]; | 292 E removeLast() => this[0]; |
286 E removeAt(index) => this[0]; | 293 E removeAt(index) => this[0]; |
287 E elementAt(index) => this[0]; | 294 E elementAt(index) => this[0]; |
288 E singleWhere(f) => this[0]; | 295 E singleWhere(f) => this[0]; |
| 296 Iterator<E> get iterator => null; |
289 }''', | 297 }''', |
290 'JSBool': 'class JSBool extends Interceptor implements bool {}', | 298 'JSBool': 'class JSBool extends Interceptor implements bool {}', |
291 'JSDouble': 'class JSDouble extends JSNumber implements double {}', | 299 'JSDouble': 'class JSDouble extends JSNumber implements double {}', |
292 'JSExtendableArray': 'class JSExtendableArray extends JSMutableArray {}', | 300 'JSExtendableArray': 'class JSExtendableArray extends JSMutableArray {}', |
293 'JSFixedArray': 'class JSFixedArray extends JSMutableArray {}', | 301 'JSFixedArray': 'class JSFixedArray extends JSMutableArray {}', |
294 'JSFunction': | 302 'JSFunction': |
295 'abstract class JSFunction extends Interceptor implements Function {}', | 303 'abstract class JSFunction extends Interceptor implements Function {}', |
296 'JSIndexable': r''' | 304 'JSIndexable': r''' |
297 abstract class JSIndexable { | 305 abstract class JSIndexable { |
298 get length; | 306 get length; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 const Map<String, String> DEFAULT_ISOLATE_HELPER_LIBRARY = | 385 const Map<String, String> DEFAULT_ISOLATE_HELPER_LIBRARY = |
378 const <String, String>{ | 386 const <String, String>{ |
379 'startRootIsolate': 'void startRootIsolate(entry, args) {}', | 387 'startRootIsolate': 'void startRootIsolate(entry, args) {}', |
380 '_currentIsolate': 'var _currentIsolate;', | 388 '_currentIsolate': 'var _currentIsolate;', |
381 '_callInIsolate': 'var _callInIsolate;', | 389 '_callInIsolate': 'var _callInIsolate;', |
382 '_WorkerBase': 'class _WorkerBase {}', | 390 '_WorkerBase': 'class _WorkerBase {}', |
383 }; | 391 }; |
384 | 392 |
385 const Map<String, String> DEFAULT_ASYNC_LIBRARY = const <String, String>{ | 393 const Map<String, String> DEFAULT_ASYNC_LIBRARY = const <String, String>{ |
386 'DeferredLibrary': 'class DeferredLibrary {}', | 394 'DeferredLibrary': 'class DeferredLibrary {}', |
387 'Future': | 395 'Future': |
388 ''' | 396 ''' |
389 class Future<T> { | 397 class Future<T> { |
390 Future.value([value]); | 398 Future.value([value]); |
391 } | 399 } |
392 ''', | 400 ''', |
393 'Stream': 'class Stream<T> {}', | 401 'Stream': 'class Stream<T> {}', |
394 'Completer': 'class Completer<T> {}', | 402 'Completer': 'class Completer<T> {}', |
395 'StreamIterator': 'class StreamIterator<T> {}', | 403 'StreamIterator': 'class StreamIterator<T> {}', |
396 }; | 404 }; |
397 | 405 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 437 |
430 const LookupMap(this._entries, [this._nestedMaps = const []]) | 438 const LookupMap(this._entries, [this._nestedMaps = const []]) |
431 : _key = null, _value = null; | 439 : _key = null, _value = null; |
432 | 440 |
433 const LookupMap.pair(this._key, this._value) | 441 const LookupMap.pair(this._key, this._value) |
434 : _entries = const [], _nestedMaps = const []; | 442 : _entries = const [], _nestedMaps = const []; |
435 V operator[](K k) => null; | 443 V operator[](K k) => null; |
436 }''', | 444 }''', |
437 '_version': 'const _version = "0.0.1+1";', | 445 '_version': 'const _version = "0.0.1+1";', |
438 }; | 446 }; |
OLD | NEW |