blob: 518a5bc236ac46fbbba9381ff30146409c25f22f (
plain)
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
|
package helpers
import (
"github.com/spf13/viper"
"github.com/gohugoio/hugo/hugofs"
)
func newTestPathSpec(fs *hugofs.Fs, v *viper.Viper) *PathSpec {
l := NewDefaultLanguage(v)
ps, _ := NewPathSpec(fs, l)
return ps
}
func newTestDefaultPathSpec(configKeyValues ...interface{}) *PathSpec {
v := viper.New()
fs := hugofs.NewMem(v)
cfg := newTestCfg(fs)
for i := 0; i < len(configKeyValues); i += 2 {
cfg.Set(configKeyValues[i].(string), configKeyValues[i+1])
}
return newTestPathSpec(fs, cfg)
}
func newTestCfg(fs *hugofs.Fs) *viper.Viper {
v := viper.New()
v.SetFs(fs.Source)
return v
}
func newTestContentSpec() *ContentSpec {
v := viper.New()
spec, err := NewContentSpec(v)
if err != nil {
panic(err)
}
return spec
}
|