| 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/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 10 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| 11 import 'package:path/path.dart' as path; | |
| 12 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
| 13 | 12 |
| 14 void initializeTestEnvironment([path.Context context]) {} | |
| 15 | |
| 16 /** | 13 /** |
| 17 * The type of an assertion which asserts properties of [T]s. | 14 * The type of an assertion which asserts properties of [T]s. |
| 18 */ | 15 */ |
| 19 typedef void Asserter<T>(T type); | 16 typedef void Asserter<T>(T type); |
| 20 | 17 |
| 21 /** | 18 /** |
| 22 * The type of a function which given an [S], builds an assertion over [T]s. | 19 * The type of a function which given an [S], builds an assertion over [T]s. |
| 23 */ | 20 */ |
| 24 typedef Asserter<T> AsserterBuilder<S, T>(S arg); | 21 typedef Asserter<T> AsserterBuilder<S, T>(S arg); |
| 25 | 22 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Asserter<DartType> isType(DartType argument) => (DartType t) { | 288 Asserter<DartType> isType(DartType argument) => (DartType t) { |
| 292 expect(t, same(argument)); | 289 expect(t, same(argument)); |
| 293 }; | 290 }; |
| 294 | 291 |
| 295 /** | 292 /** |
| 296 * Given a type, produce an assertion that a type has the same element. | 293 * Given a type, produce an assertion that a type has the same element. |
| 297 */ | 294 */ |
| 298 Asserter<DartType> sameElement(DartType elementType) => | 295 Asserter<DartType> sameElement(DartType elementType) => |
| 299 hasElement(elementType.element); | 296 hasElement(elementType.element); |
| 300 } | 297 } |
| OLD | NEW |