-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmain_test.go
More file actions
49 lines (44 loc) · 856 Bytes
/
Copy pathmain_test.go
File metadata and controls
49 lines (44 loc) · 856 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"testing"
"github.com/mxlint/mxlint-cli/lint"
)
func TestEffectiveLintUseCache(t *testing.T) {
falseValue := false
tests := []struct {
name string
config *lint.Config
expected bool
}{
{
name: "nil config defaults to cache enabled",
config: nil,
expected: true,
},
{
name: "cache enabled by default",
config: &lint.Config{
Cache: lint.ConfigCacheSpec{
Enable: nil,
},
},
expected: true,
},
{
name: "cache disabled by cache.enable",
config: &lint.Config{
Cache: lint.ConfigCacheSpec{
Enable: &falseValue,
},
},
expected: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := effectiveLintUseCache(tt.config); got != tt.expected {
t.Fatalf("expected %t, got %t", tt.expected, got)
}
})
}
}