| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:pub/src/package.dart'; | 9 import 'package:pub/src/package.dart'; |
| 10 import 'package:pub/src/pubspec.dart'; | 10 import 'package:pub/src/pubspec.dart'; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 test("throws if version is not a version constraint", () { | 223 test("throws if version is not a version constraint", () { |
| 224 expectPubspecException(''' | 224 expectPubspecException(''' |
| 225 dependencies: | 225 dependencies: |
| 226 foo: | 226 foo: |
| 227 mock: ok | 227 mock: ok |
| 228 version: not constraint | 228 version: not constraint |
| 229 ''', (pubspec) => pubspec.dependencies); | 229 ''', (pubspec) => pubspec.dependencies); |
| 230 }); | 230 }); |
| 231 | 231 |
| 232 test("throws if there's no source", () { |
| 233 expectPubspecException(''' |
| 234 dependencies: |
| 235 foo: |
| 236 version: 1.2.3 |
| 237 ''', (pubspec) => pubspec.dependencies); |
| 238 }); |
| 239 |
| 232 test("throws if 'name' is not a string", () { | 240 test("throws if 'name' is not a string", () { |
| 233 expectPubspecException('name: [not, a, string]', | 241 expectPubspecException('name: [not, a, string]', |
| 234 (pubspec) => pubspec.name); | 242 (pubspec) => pubspec.name); |
| 235 }); | 243 }); |
| 236 | 244 |
| 237 test("throws if version is not a string", () { | 245 test("throws if version is not a string", () { |
| 238 expectPubspecException('version: [2, 0, 0]', | 246 expectPubspecException('version: [2, 0, 0]', |
| 239 (pubspec) => pubspec.version, | 247 (pubspec) => pubspec.version, |
| 240 '"version" field must be a string'); | 248 '"version" field must be a string'); |
| 241 }); | 249 }); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 test("uses the key if the value is null", () { | 530 test("uses the key if the value is null", () { |
| 523 var pubspec = new Pubspec.parse(''' | 531 var pubspec = new Pubspec.parse(''' |
| 524 executables: | 532 executables: |
| 525 command: | 533 command: |
| 526 ''', sources); | 534 ''', sources); |
| 527 expect(pubspec.executables['command'], equals('command')); | 535 expect(pubspec.executables['command'], equals('command')); |
| 528 }); | 536 }); |
| 529 }); | 537 }); |
| 530 }); | 538 }); |
| 531 } | 539 } |
| OLD | NEW |