| 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);
|
|
|