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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 }; | 100 }; |
101 | 101 |
102 const String DEFAULT_PATCH_CORE_SOURCE = r''' | 102 const String DEFAULT_PATCH_CORE_SOURCE = r''' |
103 import 'dart:_js_helper'; | 103 import 'dart:_js_helper'; |
104 import 'dart:_interceptors'; | 104 import 'dart:_interceptors'; |
105 import 'dart:_isolate_helper'; | 105 import 'dart:_isolate_helper'; |
106 import 'dart:async'; | 106 import 'dart:async'; |
107 '''; | 107 '''; |
108 | 108 |
109 const Map<String, String> DEFAULT_JS_HELPER_LIBRARY = const <String, String>{ | 109 const Map<String, String> DEFAULT_JS_HELPER_LIBRARY = const <String, String>{ |
| 110 'assertTest': 'assertTest(a) {}', |
| 111 'assertThrow': 'assertThrow(a) {}', |
110 'assertHelper': 'assertHelper(a) {}', | 112 'assertHelper': 'assertHelper(a) {}', |
111 'assertIsSubtype': 'assertIsSubtype(subtype, supertype, message) {}', | 113 'assertIsSubtype': 'assertIsSubtype(subtype, supertype, message) {}', |
112 'assertSubtype': 'assertSubtype(object, isField, checks, asField) {}', | 114 'assertSubtype': 'assertSubtype(object, isField, checks, asField) {}', |
113 'assertSubtypeOfRuntimeType': 'assertSubtypeOfRuntimeType(object, type) {}', | 115 'assertSubtypeOfRuntimeType': 'assertSubtypeOfRuntimeType(object, type) {}', |
114 'asyncHelper': 'asyncHelper(object, asyncBody, completer) {}', | 116 'asyncHelper': 'asyncHelper(object, asyncBody, completer) {}', |
115 'boolConversionCheck': 'boolConversionCheck(x) {}', | 117 'boolConversionCheck': 'boolConversionCheck(x) {}', |
116 'boolTypeCast': 'boolTypeCast(value) {}', | 118 'boolTypeCast': 'boolTypeCast(value) {}', |
117 'boolTypeCheck': 'boolTypeCheck(value) {}', | 119 'boolTypeCheck': 'boolTypeCheck(value) {}', |
118 'checkSubtype': 'checkSubtype(object, isField, checks, asField) {}', | 120 'checkSubtype': 'checkSubtype(object, isField, checks, asField) {}', |
119 'checkSubtypeOfRuntimeType': 'checkSubtypeOfRuntimeType(o, t) {}', | 121 'checkSubtypeOfRuntimeType': 'checkSubtypeOfRuntimeType(o, t) {}', |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 _shrBothPositive(other) => 42; | 363 _shrBothPositive(other) => 42; |
362 _shrReceiverPositive(other) => 42; | 364 _shrReceiverPositive(other) => 42; |
363 _shrOtherPositive(other) => 42; | 365 _shrOtherPositive(other) => 42; |
364 | 366 |
365 abs() => (this is JSInt) ? 42 : 42.2; | 367 abs() => (this is JSInt) ? 42 : 42.2; |
366 remainder(other) => (this is JSInt) ? 42 : 42.2; | 368 remainder(other) => (this is JSInt) ? 42 : 42.2; |
367 truncate() => 42; | 369 truncate() => 42; |
368 }''', | 370 }''', |
369 'JSString': r''' | 371 'JSString': r''' |
370 class JSString extends Interceptor implements String, JSIndexable { | 372 class JSString extends Interceptor implements String, JSIndexable { |
371 var split; | 373 split(pattern) => []; |
372 var length; | 374 int get length => 42; |
373 operator[](index) {} | 375 operator[](index) {} |
374 toString() {} | 376 toString() {} |
375 operator+(other) => this; | 377 operator+(other) => this; |
376 codeUnitAt(index) => 42; | 378 codeUnitAt(index) => 42; |
377 }''', | 379 }''', |
378 'JSUInt31': 'class JSUInt31 extends JSUInt32 {}', | 380 'JSUInt31': 'class JSUInt31 extends JSUInt32 {}', |
379 'JSUInt32': 'class JSUInt32 extends JSPositiveInt {}', | 381 'JSUInt32': 'class JSUInt32 extends JSPositiveInt {}', |
380 'ObjectInterceptor': 'class ObjectInterceptor {}', | 382 'ObjectInterceptor': 'class ObjectInterceptor {}', |
381 'PlainJavaScriptObject': 'class PlainJavaScriptObject {}', | 383 'PlainJavaScriptObject': 'class PlainJavaScriptObject {}', |
382 'UnknownJavaScriptObject': 'class UnknownJavaScriptObject {}', | 384 'UnknownJavaScriptObject': 'class UnknownJavaScriptObject {}', |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 439 |
438 const LookupMap(this._entries, [this._nestedMaps = const []]) | 440 const LookupMap(this._entries, [this._nestedMaps = const []]) |
439 : _key = null, _value = null; | 441 : _key = null, _value = null; |
440 | 442 |
441 const LookupMap.pair(this._key, this._value) | 443 const LookupMap.pair(this._key, this._value) |
442 : _entries = const [], _nestedMaps = const []; | 444 : _entries = const [], _nestedMaps = const []; |
443 V operator[](K k) => null; | 445 V operator[](K k) => null; |
444 }''', | 446 }''', |
445 '_version': 'const _version = "0.0.1+1";', | 447 '_version': 'const _version = "0.0.1+1";', |
446 }; | 448 }; |
OLD | NEW |