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 '../../../pkg/unittest/unittest.dart'; | 7 import '../../../pkg/unittest/unittest.dart'; |
8 import '../../pub/pubspec.dart'; | 8 import '../../pub/pubspec.dart'; |
9 import '../../pub/source.dart'; | 9 import '../../pub/source.dart'; |
10 import '../../pub/source_registry.dart'; | 10 import '../../pub/source_registry.dart'; |
(...skipping 18 matching lines...) Expand all Loading... |
29 test("allows a version constraint for dependencies", () { | 29 test("allows a version constraint for dependencies", () { |
30 var pubspec = new Pubspec.parse(''' | 30 var pubspec = new Pubspec.parse(''' |
31 dependencies: | 31 dependencies: |
32 foo: | 32 foo: |
33 mock: ok | 33 mock: ok |
34 version: ">=1.2.3 <3.4.5" | 34 version: ">=1.2.3 <3.4.5" |
35 ''', sources); | 35 ''', sources); |
36 | 36 |
37 var foo = pubspec.dependencies[0]; | 37 var foo = pubspec.dependencies[0]; |
38 expect(foo.name, equals('foo')); | 38 expect(foo.name, equals('foo')); |
39 expect(foo.constraint.allows(new Version(1, 2, 3))); | 39 expect(foo.constraint.allows(new Version(1, 2, 3)), isTrue); |
40 expect(foo.constraint.allows(new Version(1, 2, 5))); | 40 expect(foo.constraint.allows(new Version(1, 2, 5)), isTrue); |
41 expect(!foo.constraint.allows(new Version(3, 4, 5))); | 41 expect(foo.constraint.allows(new Version(3, 4, 5)), isFalse); |
42 }); | 42 }); |
43 | 43 |
44 test("throws if the description isn't valid", () { | 44 test("throws if the description isn't valid", () { |
45 expect(() { | 45 expect(() { |
46 new Pubspec.parse(''' | 46 new Pubspec.parse(''' |
47 dependencies: | 47 dependencies: |
48 foo: | 48 foo: |
49 mock: bad | 49 mock: bad |
50 ''', sources); | 50 ''', sources); |
51 }, throwsFormatException); | 51 }, throwsFormatException); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 # Including for completeness | 99 # Including for completeness |
100 # ...and hoping the spec expands to include details about author, version, etc | 100 # ...and hoping the spec expands to include details about author, version, etc |
101 # See http://www.dartlang.org/docs/pub-package-manager/ for details | 101 # See http://www.dartlang.org/docs/pub-package-manager/ for details |
102 ''', sources); | 102 ''', sources); |
103 expect(pubspec.version, equals(Version.none)); | 103 expect(pubspec.version, equals(Version.none)); |
104 expect(pubspec.dependencies, isEmpty); | 104 expect(pubspec.dependencies, isEmpty); |
105 }); | 105 }); |
106 }); | 106 }); |
107 }); | 107 }); |
108 } | 108 } |
OLD | NEW |