-
Notifications
You must be signed in to change notification settings - Fork 0
/
markers_test.go
50 lines (41 loc) · 1.24 KB
/
markers_test.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package markers
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestIsReservedMarker(t *testing.T) {
assert.True(t, IsReservedMarker("import"))
assert.True(t, IsReservedMarker("deprecated"))
assert.True(t, IsReservedMarker("override"))
assert.False(t, IsReservedMarker("nonReservedMarker"))
}
func TestImportMarker_PkgPath(t *testing.T) {
importMarker := &ImportMarker{
Pkg: "github.com/procyon-projects/[email protected]",
}
assert.Equal(t, "github.com/procyon-projects/marker", importMarker.PkgPath())
}
func TestImportMarker_PkgVersion(t *testing.T) {
importMarker := &ImportMarker{
Pkg: "github.com/procyon-projects/[email protected]",
}
assert.Equal(t, "v1.2.3", importMarker.PkgVersion())
}
func TestImportMarker_PkgVersionLatest(t *testing.T) {
importMarker := &ImportMarker{
Pkg: "github.com/procyon-projects/marker",
}
assert.Equal(t, "latest", importMarker.PkgVersion())
}
func TestImportMarker_Validate_IfValueIsMissing(t *testing.T) {
importMarker := &ImportMarker{
Pkg: "github.com/procyon-projects/marker",
}
assert.Error(t, importMarker.Validate())
}
func TestImportMarker_Validate_IfPkgIsMissing(t *testing.T) {
importMarker := &ImportMarker{
Value: "anyValue",
}
assert.Error(t, importMarker.Validate())
}