This repository was archived by the owner on Apr 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +61
-1
lines changed Expand file tree Collapse file tree 6 files changed +61
-1
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4+
5+ library analyzer_cli.src.utils;
6+
7+ import 'dart:io' ;
8+
9+ /// Parses a package map cfg file into a String map.
10+ Map <String , String > readPackageMap (File file) {
11+ var map = < String , String > {};
12+ file.readAsLinesSync ().forEach ((String line) {
13+ if (! line.startsWith ('#' )) {
14+ var entry = line.split ('=' );
15+ map[entry[0 ]] = entry[1 ];
16+ }
17+ });
18+ return map;
19+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import 'package:unittest/unittest.dart';
77import 'error_test.dart' as error;
88import 'options_test.dart' as options;
99import 'reporter_test.dart' as reporter;
10+ import 'utils_test.dart' as utils;
1011
1112main () {
1213 // Tidy up output.
@@ -16,4 +17,5 @@ main() {
1617 error.main ();
1718 options.main ();
1819 reporter.main ();
20+ utils.main ();
1921}
Original file line number Diff line number Diff line change 1+ # This file has been generate by the Dart tool pub on Apr 14 09:14:14 2015.
2+ # It contains a map from Dart package names to Dart package locations.
3+ # Dart tools, including Dart VM and and Dart analyzer, rely on the content.
4+ # AUTO GENERATED - DO NOT EDIT
5+ unittest =/home/somebody/.pub/cache/unittest-0.9.9/lib/
6+ async =/home/somebody/.pub/cache/async-1.1.0/lib/
7+ quiver =/home/somebody/.pub/cache/quiver-1.2.1/lib/
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ library analyzer_cli.test.error;
66
77import 'package:unittest/unittest.dart' ;
88
9- import 'utils .dart' ;
9+ import 'test_utils .dart' ;
1010
1111void main () {
1212 groupSep = ' | ' ;
File renamed without changes.
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4+
5+ library analyzer_cli.test.utils;
6+
7+ import 'dart:io' ;
8+
9+ import 'package:analyzer_cli/src/utils.dart' ;
10+ import 'package:unittest/unittest.dart' ;
11+
12+ main () {
13+ groupSep = ' | ' ;
14+
15+ defineTests ();
16+ }
17+
18+ defineTests () {
19+ group ('utils' , () {
20+ group ('packagemap.cfg' , () {
21+ test ('parsing' , () {
22+ var map = readPackageMap (new File ('test/data/test.cfg' ));
23+ expect (map, containsPair (
24+ 'unittest' , '/home/somebody/.pub/cache/unittest-0.9.9/lib/' ));
25+ expect (map, containsPair (
26+ 'async' , '/home/somebody/.pub/cache/async-1.1.0/lib/' ));
27+ expect (map, containsPair (
28+ 'quiver' , '/home/somebody/.pub/cache/quiver-1.2.1/lib/' ));
29+ });
30+ });
31+ });
32+ }
You can’t perform that action at this time.
0 commit comments