Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: lib/src/packages_impl.dart

Issue 1152173005: Add more tests (Closed) Base URL: https://github.com/dart-lang/package_config.git@master
Patch Set: Test discovery functionality Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/discovery_test.dart » ('j') | test/discovery_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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 package_config.packages_impl; 5 library package_config.packages_impl;
6 6
7 import "dart:collection" show UnmodifiableMapView; 7 import "dart:collection" show UnmodifiableMapView;
8 import "dart:io" show Directory; 8 import "dart:io" show Directory;
9 import "package:path/path.dart" as path; 9 import "package:path/path.dart" as path;
10 import "../packages.dart"; 10 import "../packages.dart";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 Map<String, Uri> asMap() => new UnmodifiableMapView<String, Uri>(_mapping); 64 Map<String, Uri> asMap() => new UnmodifiableMapView<String, Uri>(_mapping);
65 } 65 }
66 66
67 /// A [Packages] implementation based on a local directory. 67 /// A [Packages] implementation based on a local directory.
68 class FilePackagesDirectoryPackages extends _PackagesBase { 68 class FilePackagesDirectoryPackages extends _PackagesBase {
69 final Directory _packageDir; 69 final Directory _packageDir;
70 FilePackagesDirectoryPackages(this._packageDir); 70 FilePackagesDirectoryPackages(this._packageDir);
71 71
72 Uri _getBase(String packageName) => 72 Uri _getBase(String packageName) =>
73 new Uri.directory(path.join(packageName,'')); 73 new Uri.directory(path.join(_packageDir.path, packageName, ''));
Lasse Reichstein Nielsen 2015/05/26 07:14:59 Tests found bug! Yey!
74 74
75 Iterable<String> _listPackageNames() { 75 Iterable<String> _listPackageNames() {
76 return _packageDir.listSync() 76 return _packageDir.listSync()
77 .where((e) => e is Directory) 77 .where((e) => e is Directory)
78 .map((e) => path.basename(e.path)); 78 .map((e) => path.basename(e.path));
79 } 79 }
80 80
81 Iterable<String> get packages { 81 Iterable<String> get packages {
82 return _listPackageNames(); 82 return _listPackageNames();
83 } 83 }
(...skipping 25 matching lines...) Expand all
109 } 109 }
110 110
111 Iterable<String> get packages { 111 Iterable<String> get packages {
112 throw _failListingPackages(); 112 throw _failListingPackages();
113 } 113 }
114 114
115 Map<String, Uri> asMap() { 115 Map<String, Uri> asMap() {
116 throw _failListingPackages(); 116 throw _failListingPackages();
117 } 117 }
118 } 118 }
OLDNEW
« no previous file with comments | « no previous file | test/discovery_test.dart » ('j') | test/discovery_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698