-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check for empty string and add pep440 spec
- Loading branch information
1 parent
2248839
commit e0d3374
Showing
3 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local pep440 = require "mason-core.pep440" | ||
|
||
describe("pep440 version checking", function() | ||
it("should check single version specifier", function() | ||
assert.is_false(pep440.check_version("3.5.0", ">=3.6")) | ||
assert.is_true(pep440.check_version("3.6.0", ">=3.6")) | ||
assert.is_false(pep440.check_version("3.6.0", ">=3.6.1")) | ||
end) | ||
|
||
it("should check version specifier with lower and upper bound", function() | ||
assert.is_true(pep440.check_version("3.8.0", ">=3.8,<3.12")) | ||
assert.is_false(pep440.check_version("3.12.0", ">=3.8,<3.12")) | ||
assert.is_true(pep440.check_version("3.12.0", ">=3.8,<4.0.0")) | ||
end) | ||
|
||
it("should check multiple specifiers with different constraints", function() | ||
assert.is_false(pep440.check_version("3.5.0", "!=4.0,<=4.0,>=3.8")) | ||
assert.is_false(pep440.check_version("4.0.0", "!=4.0,<=4.0,>=3.8")) | ||
assert.is_true(pep440.check_version("3.8.1", "!=4.0,<=4.0,>=3.8")) | ||
assert.is_true(pep440.check_version("3.12.0", "!=4.0,<=4.0,>=3.8")) | ||
end) | ||
end) |