Chromium Code Reviews| Index: utils/tests/pub/version_test.dart |
| diff --git a/utils/tests/pub/version_test.dart b/utils/tests/pub/version_test.dart |
| index d5b1849870e84d4387d021390f53978a77a05c5c..3ebc114bff3e863b88a085fb2a8bb8e9148bf425 100644 |
| --- a/utils/tests/pub/version_test.dart |
| +++ b/utils/tests/pub/version_test.dart |
| @@ -10,6 +10,8 @@ import '../../pub/utils.dart'; |
| import '../../pub/version.dart'; |
| main() { |
| + initConfig(); |
| + |
| final v123 = new Version.parse('1.2.3'); |
| final v114 = new Version.parse('1.1.4'); |
| final v124 = new Version.parse('1.2.4'); |
| @@ -386,10 +388,33 @@ main() { |
| new Version.parse('3.4.5')])); |
| }); |
| + test('ignores whitespace around operators', () { |
| + var constraint = new VersionConstraint.parse(' >1.0.0>=1.2.3 < 1.3.0'); |
| + expect(constraint, allows([ |
| + new Version.parse('1.2.3'), |
| + new Version.parse('1.2.5')])); |
| + expect(constraint, doesNotAllow([ |
| + new Version.parse('1.2.3-pre'), |
| + new Version.parse('1.3.0'), |
| + new Version.parse('3.4.5')])); |
| + }); |
| + |
| test('throws FormatException on a bad string', () { |
| expect(() => new VersionConstraint.parse(''), throwsFormatException); |
| expect(() => new VersionConstraint.parse(' '), throwsFormatException); |
| - expect(() => new VersionConstraint.parse('not a version'), |
| + expect(() => new VersionConstraint.parse('1.0.0 what is this here'), |
| + throwsFormatException); |
| + |
| + // Multiple operators. |
| + expect(() => new VersionConstraint.parse('<>1.0.0'), |
| + throwsFormatException); |
| + |
| + // "any" after operator. |
| + expect(() => new VersionConstraint.parse('<any'), |
| + throwsFormatException); |
| + |
| + // Trailing operator. |
| + expect(() => new VersionConstraint.parse('1.0.0<'), |
| throwsFormatException); |
|
nweiz
2013/02/21 01:31:11
Other strings to test: "foo", "1.0.0foo", "anythin
Bob Nystrom
2013/02/21 20:00:50
Done.
|
| }); |
| }); |