1- // Copyright (c) 2017 , the Dart project authors. Please see the AUTHORS file
1+ // Copyright (c) 2018 , the Dart project authors. Please see the AUTHORS file
22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
@@ -7,39 +7,41 @@ import 'package:build_test/build_test.dart';
77import 'package:source_gen/source_gen.dart' ;
88import 'package:test/test.dart' ;
99
10+ final _source = r'''
11+ library test_lib;
12+
13+ export 'dart:collection' show LinkedHashMap;
14+ export 'package:source_gen/source_gen.dart' show Generator;
15+ import 'dart:async' show Stream;
16+
17+ class Example {}
18+ ''' ;
19+
1020void main () {
1121 LibraryReader library;
1222
1323 setUpAll (() async {
1424 library = await resolveSource (
15- r'''
16- library test_lib;
17-
18- export 'dart:collection' show LinkedHashMap;
19- export 'package:source_gen/source_gen.dart' show Generator;
20- import 'dart:async' show Stream;
21-
22- class Example {}
23- ''' ,
24- (resolver) async =>
25- new LibraryReader (await resolver.findLibraryByName ('test_lib' )));
25+ _source,
26+ (r) async => new LibraryReader (await r.findLibraryByName ('test_lib' )),
27+ );
2628 });
2729
28- final isClassElement = const isInstanceOf <ClassElement >();
29-
3030 test ('should return a type not exported' , () {
31- expect (library.findType ('Example' ), isClassElement );
31+ expect (library.findType ('Example' ), _isClassElement );
3232 });
3333
3434 test ('should return a type exported from dart:' , () {
35- expect (library.findType ('LinkedHashMap' ), isClassElement );
35+ expect (library.findType ('LinkedHashMap' ), _isClassElement );
3636 });
3737
3838 test ('should return a type exported from package:' , () {
39- expect (library.findType ('Generator' ), isClassElement );
39+ expect (library.findType ('Generator' ), _isClassElement );
4040 });
4141
4242 test ('should not return a type imported' , () {
4343 expect (library.findType ('Stream' ), isNull);
4444 });
4545}
46+
47+ final _isClassElement = const isInstanceOf <ClassElement >();
0 commit comments