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

Unified Diff: sdk/lib/_internal/pub/test/pubspec_test.dart

Issue 887483002: Don't crash 'pub get' if a dev dependency is broken. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/test/pubspec_test.dart
diff --git a/sdk/lib/_internal/pub/test/pubspec_test.dart b/sdk/lib/_internal/pub/test/pubspec_test.dart
index 542961df9e28dd79bcd977abd6e9978819652e35..4fddbd41d5182e72cfdb604e848d7a5135913f0d 100644
--- a/sdk/lib/_internal/pub/test/pubspec_test.dart
+++ b/sdk/lib/_internal/pub/test/pubspec_test.dart
@@ -12,6 +12,7 @@ import 'package:unittest/unittest.dart';
import '../lib/src/package.dart';
import '../lib/src/pubspec.dart';
import '../lib/src/source.dart';
+import '../lib/src/source/path.dart';
import '../lib/src/source_registry.dart';
import 'test_pub.dart';
@@ -44,6 +45,7 @@ main() {
group('parse()', () {
var sources = new SourceRegistry();
sources.register(new MockSource());
+ sources.register(new PathSource());
var throwsPubspecException =
throwsA(new isInstanceOf<PubspecException>('PubspecException'));
@@ -160,16 +162,19 @@ dependencies:
});
test("throws if a package is in dependencies and dev_dependencies", () {
- var contents = '''
+ expectPubspecException('''
dependencies:
foo:
mock: ok
dev_dependencies:
foo:
mock: ok
-''';
- expectPubspecException(contents, (pubspec) => pubspec.dependencies);
- expectPubspecException(contents, (pubspec) => pubspec.devDependencies);
+''', (pubspec) {
+ // This check only triggers if both [dependencies] and [devDependencies]
+ // are accessed.
+ pubspec.dependencies;
+ pubspec.devDependencies;
+ });
});
test("throws if it dependes on itself", () {
@@ -390,6 +395,16 @@ transformers:
expect(pubspec.dependencies, isEmpty);
});
+ test("throws a useful error for unresolvable path dependencies", () {
+ expectPubspecException('''
+name: pkg
+dependencies:
+ from_path: {path: non_local_path}
+''', (pubspec) => pubspec.dependencies,
+ '"non_local_path" is a relative path, but this isn\'t a local '
+ 'pubspec.');
+ });
+
group("environment", () {
test("defaults to any SDK constraint if environment is omitted", () {
var pubspec = new Pubspec.parse('', sources);

Powered by Google App Engine
This is Rietveld 408576698