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..afa68534abdb7198120d7fd8728ebad057ee119e 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,14 @@ 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) => pubspec.devDependencies); |
}); |
test("throws if it dependes on itself", () { |
@@ -390,6 +390,17 @@ transformers: |
expect(pubspec.dependencies, isEmpty); |
}); |
+ test("throws a useful error for unresolvable path dependencies", () { |
+ // It's important that this not be parsed, so that it doesn't |
Bob Nystrom
2015/01/28 23:42:00
Delete?
nweiz
2015/01/29 01:26:22
Done.
|
+ 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); |