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