| OLD | NEW |
| 1 library pubspec_test; | 1 library pubspec_test; |
| 2 import 'dart:async'; | 2 import 'dart:async'; |
| 3 import 'package:pub_semver/pub_semver.dart'; | 3 import 'package:pub_semver/pub_semver.dart'; |
| 4 import 'package:unittest/unittest.dart'; | 4 import 'package:unittest/unittest.dart'; |
| 5 import '../lib/src/package.dart'; | 5 import '../lib/src/package.dart'; |
| 6 import '../lib/src/pubspec.dart'; | 6 import '../lib/src/pubspec.dart'; |
| 7 import '../lib/src/source.dart'; | 7 import '../lib/src/source.dart'; |
| 8 import '../lib/src/source_registry.dart'; | 8 import '../lib/src/source_registry.dart'; |
| 9 import 'test_pub.dart'; | 9 import 'test_pub.dart'; |
| 10 class MockSource extends Source { | 10 class MockSource extends Source { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 mock: ok | 187 mock: ok |
| 188 version: not constraint | 188 version: not constraint |
| 189 ''', (pubspec) => pubspec.dependencies); | 189 ''', (pubspec) => pubspec.dependencies); |
| 190 }); | 190 }); |
| 191 test("throws if 'name' is not a string", () { | 191 test("throws if 'name' is not a string", () { |
| 192 expectPubspecException( | 192 expectPubspecException( |
| 193 'name: [not, a, string]', | 193 'name: [not, a, string]', |
| 194 (pubspec) => pubspec.name); | 194 (pubspec) => pubspec.name); |
| 195 }); | 195 }); |
| 196 test("throws if version is not a string", () { | 196 test("throws if version is not a string", () { |
| 197 expectPubspecException('version: 1.0', (pubspec) => pubspec.version); | 197 expectPubspecException('version: [2, 0, 0]', |
| 198 (pubspec) => pubspec.version, |
| 199 '"version" field must be a string'); |
| 200 }); |
| 201 test("throws if version is malformed (looking like a double)", () { |
| 202 expectPubspecException('version: 2.1', |
| 203 (pubspec) => pubspec.version, |
| 204 '"version" field must have three numeric components: major, minor, ' |
| 205 'and patch. Instead of "2.1", consider "2.1.0"'); |
| 206 }); |
| 207 test("throws if version is malformed (looking like an int)", () { |
| 208 expectPubspecException('version: 2', |
| 209 (pubspec) => pubspec.version, |
| 210 '"version" field must have three numeric components: major, minor, ' |
| 211 'and patch. Instead of "2", consider "2.0.0"'); |
| 198 }); | 212 }); |
| 199 test("throws if version is not a version", () { | 213 test("throws if version is not a version", () { |
| 200 expectPubspecException( | 214 expectPubspecException( |
| 201 'version: not version', | 215 'version: not version', |
| 202 (pubspec) => pubspec.version); | 216 (pubspec) => pubspec.version); |
| 203 }); | 217 }); |
| 204 test("throws if transformers isn't a list", () { | 218 test("throws if transformers isn't a list", () { |
| 205 expectPubspecException( | 219 expectPubspecException( |
| 206 'transformers: "not list"', | 220 'transformers: "not list"', |
| 207 (pubspec) => pubspec.transformers, | 221 (pubspec) => pubspec.transformers, |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 test("uses the key if the value is null", () { | 445 test("uses the key if the value is null", () { |
| 432 var pubspec = new Pubspec.parse(''' | 446 var pubspec = new Pubspec.parse(''' |
| 433 executables: | 447 executables: |
| 434 command: | 448 command: |
| 435 ''', sources); | 449 ''', sources); |
| 436 expect(pubspec.executables['command'], equals('command')); | 450 expect(pubspec.executables['command'], equals('command')); |
| 437 }); | 451 }); |
| 438 }); | 452 }); |
| 439 }); | 453 }); |
| 440 } | 454 } |
| OLD | NEW |