-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage_test.go
83 lines (64 loc) · 1.8 KB
/
coverage_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// For Coverage
//
// These tests are intended to improve the indicators of the test coverage, which has a minor role
// at the time of writing, given the predicted state of the behavior of the main code, since this file
// tests behavior that should never be executed but is only an insurance against a change in the future.
package validator
import (
"reflect"
"testing"
"time"
. "github.com/franela/goblin"
)
// go test -v -run TestCoverageFilter .
func TestCoverageFilter(t *testing.T) {
g := Goblin(t)
g.Describe(`For Coverage: filter`, func() {
g.It("failure filterMin when given invalid value", func() {
hint := filterMin(
reflect.ValueOf(NON_ZERO),
reflect.ValueOf(nil),
)
g.Assert(hint).Equal(MsgInvalidValue, hint)
})
g.It("failure filterMax when given invalid value", func() {
hint := filterMax(
reflect.ValueOf(NON_ZERO),
reflect.ValueOf(nil),
)
g.Assert(hint).Equal(MsgInvalidValue, hint)
})
g.It("failure filterEq when given invalid value", func() {
hint := filterEq(
reflect.ValueOf(NON_ZERO),
reflect.ValueOf(nil),
)
g.Assert(hint).Equal(MsgInvalidValue, hint)
})
g.It("failure filterRange when given invalid value", func() {
hint := filterRange(
reflect.ValueOf(Range{1, 2}),
reflect.ValueOf(nil),
)
g.Assert(hint).Equal(MsgInvalidValue, hint)
})
g.It("failure filterDate when given invalid rule", func() {
now := time.Now()
hint := filterDate(
"invalid-rule",
reflect.ValueOf(now),
reflect.ValueOf(now),
)
g.Assert(hint).Equal(MsgInvalidRule, hint)
})
g.It("failure filterTime when given invalid rule", func() {
now := time.Now()
hint := filterTime(
"invalid-rule",
reflect.ValueOf(now),
reflect.ValueOf(now),
)
g.Assert(hint).Equal(MsgInvalidRule, hint)
})
})
}