OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 pubspec_test; | 5 library pubspec_test; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 | 8 |
9 import '../lib/src/pubspec.dart'; | 9 import '../lib/src/pubspec.dart'; |
10 import '../lib/src/source.dart'; | 10 import '../lib/src/source.dart'; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 }); | 74 }); |
75 | 75 |
76 test("allows an empty dev dependencies map", () { | 76 test("allows an empty dev dependencies map", () { |
77 var pubspec = new Pubspec.parse(null, ''' | 77 var pubspec = new Pubspec.parse(null, ''' |
78 dev_dependencies: | 78 dev_dependencies: |
79 ''', sources); | 79 ''', sources); |
80 | 80 |
81 expect(pubspec.devDependencies, isEmpty); | 81 expect(pubspec.devDependencies, isEmpty); |
82 }); | 82 }); |
83 | 83 |
| 84 test("allows an unknown source", () { |
| 85 var pubspec = new Pubspec.parse(null, ''' |
| 86 dependencies: |
| 87 foo: |
| 88 unknown: blah |
| 89 ''', sources); |
| 90 |
| 91 var foo = pubspec.dependencies[0]; |
| 92 expect(foo.name, equals('foo')); |
| 93 expect(foo.source, equals('unknown')); |
| 94 }); |
| 95 |
84 test("throws if a package is in dependencies and dev_dependencies", () { | 96 test("throws if a package is in dependencies and dev_dependencies", () { |
85 expectFormatError(''' | 97 expectFormatError(''' |
86 dependencies: | 98 dependencies: |
87 foo: | 99 foo: |
88 mock: ok | 100 mock: ok |
89 dev_dependencies: | 101 dev_dependencies: |
90 foo: | 102 foo: |
91 mock: ok | 103 mock: ok |
92 '''); | 104 '''); |
93 }); | 105 }); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 215 |
204 test("throws if the sdk isn't a valid version constraint", () { | 216 test("throws if the sdk isn't a valid version constraint", () { |
205 expectFormatError(''' | 217 expectFormatError(''' |
206 environment: | 218 environment: |
207 sdk: "oopies" | 219 sdk: "oopies" |
208 '''); | 220 '''); |
209 }); | 221 }); |
210 }); | 222 }); |
211 }); | 223 }); |
212 } | 224 } |
OLD | NEW |