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

Unified Diff: sdk/lib/_internal/pub_generated/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
« no previous file with comments | « sdk/lib/_internal/pub_generated/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub_generated/test/pubspec_test.dart
diff --git a/sdk/lib/_internal/pub_generated/test/pubspec_test.dart b/sdk/lib/_internal/pub_generated/test/pubspec_test.dart
index b1a1b763eb07c9ddcdd0721cbaf6204629b53716..1418bf9bbfede1d9d5d46b7a5395d1efbcdc3584 100644
--- a/sdk/lib/_internal/pub_generated/test/pubspec_test.dart
+++ b/sdk/lib/_internal/pub_generated/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'));
@@ -167,16 +169,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", () {
@@ -403,6 +408,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);
« no previous file with comments | « sdk/lib/_internal/pub_generated/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698