Skip to content

Commit

Permalink
fix(semver): Fixing pattern check for caret
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed May 27, 2021
1 parent bee0dc1 commit fa548af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/semver/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (p Pattern) Check(version Version) bool {
return false
}
case lowerThan:
if !constraint.version.IsGreater(version) {
if version.IsGreater(constraint.version) || version.Equals(constraint.version) {
return false
}
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/semver/pattern_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ func TestCheck(t *testing.T) {
},
true,
},
{
"simple caret match",
safeParsePattern("^11"),
args{
version: safeParse("12"),
},
false,
},
{
"caret",
safeParsePattern("^1.0"),
Expand Down

0 comments on commit fa548af

Please sign in to comment.