| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 expectFormatError('author: 123'); | 208 expectFormatError('author: 123'); |
| 209 expectFormatError('author: {not: {a: string}}'); | 209 expectFormatError('author: {not: {a: string}}'); |
| 210 expectFormatError('author: [not, ok]'); | 210 expectFormatError('author: [not, ok]'); |
| 211 }); | 211 }); |
| 212 | 212 |
| 213 test("throws if both 'author' and 'authors' are present", () { | 213 test("throws if both 'author' and 'authors' are present", () { |
| 214 expectFormatError('{author: abe, authors: ted}'); | 214 expectFormatError('{author: abe, authors: ted}'); |
| 215 }); | 215 }); |
| 216 | 216 |
| 217 test("throws if a transformer isn't a string or map", () { |
| 218 expectFormatError('{transformers: 12}'); |
| 219 expectFormatError('{transformers: [12]}'); |
| 220 }); |
| 221 |
| 222 test("throws if a transformer's configuration isn't a map", () { |
| 223 expectFormatError('{transformers: {pkg: 12}}'); |
| 224 }); |
| 225 |
| 217 test("allows comment-only files", () { | 226 test("allows comment-only files", () { |
| 218 var pubspec = new Pubspec.parse(null, ''' | 227 var pubspec = new Pubspec.parse(null, ''' |
| 219 # No external dependencies yet | 228 # No external dependencies yet |
| 220 # Including for completeness | 229 # Including for completeness |
| 221 # ...and hoping the spec expands to include details about author, version, etc | 230 # ...and hoping the spec expands to include details about author, version, etc |
| 222 # See http://www.dartlang.org/docs/pub-package-manager/ for details | 231 # See http://www.dartlang.org/docs/pub-package-manager/ for details |
| 223 ''', sources); | 232 ''', sources); |
| 224 expect(pubspec.version, equals(Version.none)); | 233 expect(pubspec.version, equals(Version.none)); |
| 225 expect(pubspec.dependencies, isEmpty); | 234 expect(pubspec.dependencies, isEmpty); |
| 226 }); | 235 }); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 278 |
| 270 test("throws if the sdk isn't a valid version constraint", () { | 279 test("throws if the sdk isn't a valid version constraint", () { |
| 271 expectFormatError(''' | 280 expectFormatError(''' |
| 272 environment: | 281 environment: |
| 273 sdk: "oopies" | 282 sdk: "oopies" |
| 274 '''); | 283 '''); |
| 275 }); | 284 }); |
| 276 }); | 285 }); |
| 277 }); | 286 }); |
| 278 } | 287 } |
| OLD | NEW |