-
Notifications
You must be signed in to change notification settings - Fork 6
/
analyzer_test.go
33 lines (28 loc) · 990 Bytes
/
analyzer_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
package layer_test
import (
"path/filepath"
"testing"
"github.com/budougumi0617/layer"
"golang.org/x/tools/go/analysis/analysistest"
)
func TestOption(t *testing.T) {
if err := layer.Analyzer.Flags.Set("jsonlayer", `["handler", ["usecase", ["domain", "repository"]]]`); err != nil {
t.Fatal(err)
}
testdata := filepath.Join(analysistest.TestData(), "option")
analysistest.Run(t, testdata, layer.Analyzer, "handler")
}
func TestNested(t *testing.T) {
if err := layer.Analyzer.Flags.Set("jsonlayer", `["handler", ["usecase", ["domain", "repository"]]]`); err != nil {
t.Fatal(err)
}
testdata := filepath.Join(analysistest.TestData(), "nested")
analysistest.Run(t, testdata, layer.Analyzer, "handler/...")
}
func TestImportPath(t *testing.T) {
if err := layer.Analyzer.Flags.Set("jsonlayer", `["a", ["b", ["c"]]]`); err != nil {
t.Fatal(err)
}
testdata := filepath.Join(analysistest.TestData(), "importpath")
analysistest.Run(t, testdata, layer.Analyzer, "a/...")
}