forked from vulncheck-oss/go-exploit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathframework_test.go
More file actions
34 lines (29 loc) · 852 Bytes
/
framework_test.go
File metadata and controls
34 lines (29 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package exploit_test
import (
"testing"
"github.com/vulncheck-oss/go-exploit"
)
func TestCheckSemVer_Full(t *testing.T) {
if !exploit.CheckSemVer("1.0.0", "<= 1.0.0") {
t.Error("Constraint should have passed")
}
if exploit.CheckSemVer("1.0.0", "> 1.0.0") {
t.Error("Constraint should not have passed")
}
}
func TestCheckSemVer_BadVersion(t *testing.T) {
if exploit.CheckSemVer("uwu", "<= 1.0.0") {
t.Error("Version was invalid, should not have passed")
}
if exploit.CheckSemVer("1.0.0 ", "<= 1.0.0") {
t.Error("Version was invalid, should not have passed")
}
}
func TestCheckSemVer_BadConstraint(t *testing.T) {
if exploit.CheckSemVer("1.0.0", "<== 1.0.0") {
t.Error("Constraint was invalid, should not have passed")
}
if exploit.CheckSemVer("1.0.0", "xp") {
t.Error("Constraint was invalid, should not have passed")
}
}