Use proper version comparisions for querys

This commit is contained in:
Russell Greene
2022-04-22 11:58:43 -05:00
committed by Benj Fassbind
parent 4c04e77489
commit 954b222fb6
3 changed files with 30 additions and 5 deletions
+23
View File
@@ -0,0 +1,23 @@
package deb
import (
. "gopkg.in/check.v1"
)
type QuerySuite struct {
}
var _ = Suite(&QuerySuite{})
func (s *QuerySuite) TestVersionCompare(c *C) {
q := FieldQuery{"Version", VersionLess, "5.0.0.2", nil}
p100 := Package{}
p100.Version = "5.0.0.100"
p1 := Package{}
p1.Version = "5.0.0.1"
c.Check(q.Matches(&p100), Equals, false)
c.Check(q.Matches(&p1), Equals, true)
}