OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 analyzer.test.utils; | 5 library analyzer.test.utils; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 * Primitive assertion for the map type | 227 * Primitive assertion for the map type |
228 */ | 228 */ |
229 Asserter<DartType> get isMap => hasElementOf(_typeProvider.mapType); | 229 Asserter<DartType> get isMap => hasElementOf(_typeProvider.mapType); |
230 | 230 |
231 /** | 231 /** |
232 * Primitive assertion for the num type | 232 * Primitive assertion for the num type |
233 */ | 233 */ |
234 Asserter<DartType> get isNum => isType(_typeProvider.numType); | 234 Asserter<DartType> get isNum => isType(_typeProvider.numType); |
235 | 235 |
236 /** | 236 /** |
| 237 * Primitive assertion for the Object type |
| 238 */ |
| 239 Asserter<DartType> get isObject => isType(_typeProvider.objectType); |
| 240 |
| 241 /** |
237 * Primitive assertion for the string type | 242 * Primitive assertion for the string type |
238 */ | 243 */ |
239 Asserter<DartType> get isString => isType(_typeProvider.stringType); | 244 Asserter<DartType> get isString => isType(_typeProvider.stringType); |
240 | 245 |
241 /** | 246 /** |
242 * Assert that a type has the element that is equal to the [expected]. | 247 * Assert that a type has the element that is equal to the [expected]. |
243 */ | 248 */ |
244 Asserter<DartType> hasElement(Element expected) => | 249 Asserter<DartType> hasElement(Element expected) => |
245 (DartType type) => expect(expected, type.element); | 250 (DartType type) => expect(expected, type.element); |
246 | 251 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 Asserter<DartType> argAssert0, Asserter<DartType> argAssert1) => | 298 Asserter<DartType> argAssert0, Asserter<DartType> argAssert1) => |
294 isInstantiationOf(isMap)([argAssert0, argAssert1]); | 299 isInstantiationOf(isMap)([argAssert0, argAssert1]); |
295 | 300 |
296 /** | 301 /** |
297 * Assert that a type is equal to the [expected]. | 302 * Assert that a type is equal to the [expected]. |
298 */ | 303 */ |
299 Asserter<DartType> isType(DartType expected) => (DartType t) { | 304 Asserter<DartType> isType(DartType expected) => (DartType t) { |
300 expect(t, expected); | 305 expect(t, expected); |
301 }; | 306 }; |
302 } | 307 } |
OLD | NEW |