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