Skip to content

Commit 83f0fcb

Browse files
committed
feat(conf): test enhanced
1 parent 66e65b9 commit 83f0fcb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

conf/config.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var configSample []byte
1515
var Convert struct {
1616
Source string
1717
Target string
18-
ProcessFiles []*File
18+
ProcessFiles []File
1919
EnableRegex bool
2020
}
2121

@@ -62,10 +62,10 @@ func update() {
6262
log.L().Sugar().Fatal("source or target is empty")
6363
}
6464

65-
Convert.ProcessFiles = make([]*File, 0)
65+
Convert.ProcessFiles = make([]File, 0)
6666
for _, file := range viper.Get("convert.processFiles").([]interface{}) {
6767
t := file.(map[string]interface{})
68-
f := &File{
68+
f := File{
6969
Name: t["name"].(string),
7070
Type: t["type"].(string),
7171
}

conf/config_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ import (
44
"testing"
55

66
"github.com/dn-11/provider2domainset/conf"
7+
"github.com/dn-11/provider2domainset/log"
78
)
89

910
func TestParseConfig(t *testing.T) {
1011
conf.Init("config-sample.yaml")
12+
13+
log.L().Sugar().Infof("log: %+v", conf.Log)
14+
log.L().Sugar().Infof("convert: %+v", conf.Convert)
15+
log.L().Sugar().Infof("service: %+v", conf.Service)
1116
}

0 commit comments

Comments
 (0)