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 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/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/sdk.dart'; | 10 import 'package:analyzer/src/generated/sdk.dart'; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void print(Object object) {} | 101 void print(Object object) {} |
102 '''); | 102 '''); |
103 | 103 |
104 static const _MockSdkLibrary LIB_ASYNC = | 104 static const _MockSdkLibrary LIB_ASYNC = |
105 const _MockSdkLibrary('dart:async', '/lib/async/async.dart', ''' | 105 const _MockSdkLibrary('dart:async', '/lib/async/async.dart', ''' |
106 library dart.async; | 106 library dart.async; |
107 | 107 |
108 import 'dart:math'; | 108 import 'dart:math'; |
109 | 109 |
110 class Future<T> { | 110 class Future<T> { |
| 111 factory Future.delayed(Duration duration, [T computation()]) => null; |
| 112 factory Future.value([value]) => null; |
111 static Future wait(List<Future> futures) => null; | 113 static Future wait(List<Future> futures) => null; |
112 } | 114 } |
113 | 115 |
114 class Stream<T> {} | 116 class Stream<T> {} |
115 abstract class StreamTransformer<S, T> {} | 117 abstract class StreamTransformer<S, T> {} |
116 '''); | 118 '''); |
117 | 119 |
118 static const _MockSdkLibrary LIB_COLLECTION = | 120 static const _MockSdkLibrary LIB_COLLECTION = |
119 const _MockSdkLibrary('dart:collection', '/lib/collection/collection.dart'
, ''' | 121 const _MockSdkLibrary('dart:collection', '/lib/collection/collection.dart'
, ''' |
120 library dart.collection; | 122 library dart.collection; |
(...skipping 15 matching lines...) Expand all Loading... |
136 const _MockSdkLibrary('dart:math', '/lib/math/math.dart', ''' | 138 const _MockSdkLibrary('dart:math', '/lib/math/math.dart', ''' |
137 library dart.math; | 139 library dart.math; |
138 const double E = 2.718281828459045; | 140 const double E = 2.718281828459045; |
139 const double PI = 3.1415926535897932; | 141 const double PI = 3.1415926535897932; |
140 const double LN10 = 2.302585092994046; | 142 const double LN10 = 2.302585092994046; |
141 num min(num a, num b) => 0; | 143 num min(num a, num b) => 0; |
142 num max(num a, num b) => 0; | 144 num max(num a, num b) => 0; |
143 external double cos(num x); | 145 external double cos(num x); |
144 external double sin(num x); | 146 external double sin(num x); |
145 external double sqrt(num x); | 147 external double sqrt(num x); |
146 class Random {} | 148 class Random { |
| 149 bool nextBool() => true; |
| 150 double nextDouble() => 2.0; |
| 151 int nextInt() => 1; |
| 152 } |
147 '''); | 153 '''); |
148 | 154 |
149 static const _MockSdkLibrary LIB_HTML = | 155 static const _MockSdkLibrary LIB_HTML = |
150 const _MockSdkLibrary('dart:html', '/lib/html/dartium/html_dartium.dart',
''' | 156 const _MockSdkLibrary('dart:html', '/lib/html/dartium/html_dartium.dart',
''' |
151 library dart.html; | 157 library dart.html; |
152 class HtmlElement {} | 158 class HtmlElement {} |
153 '''); | 159 '''); |
154 | 160 |
155 static const List<SdkLibrary> LIBRARIES = const [ | 161 static const List<SdkLibrary> LIBRARIES = const [ |
156 LIB_CORE, | 162 LIB_CORE, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 bool get isInternal => throw unimplemented; | 303 bool get isInternal => throw unimplemented; |
298 | 304 |
299 @override | 305 @override |
300 bool get isShared => throw unimplemented; | 306 bool get isShared => throw unimplemented; |
301 | 307 |
302 @override | 308 @override |
303 bool get isVmLibrary => throw unimplemented; | 309 bool get isVmLibrary => throw unimplemented; |
304 | 310 |
305 UnimplementedError get unimplemented => new UnimplementedError(); | 311 UnimplementedError get unimplemented => new UnimplementedError(); |
306 } | 312 } |
OLD | NEW |