This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
app:
|
||||
title: yaml title
|
||||
name:
|
||||
var:
|
||||
- test
|
||||
bool_var: true
|
||||
duration_var: 21m
|
||||
empty_var:
|
||||
url_var: "http://google.com/"
|
||||
time_var: "2020-01-02T15:04:05Z"
|
||||
cfg:
|
||||
duration: 21m
|
||||
enabled: true
|
||||
type: yaml
|
||||
@@ -1,17 +0,0 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func FixturePath(file string) string {
|
||||
path := "fixture/"
|
||||
|
||||
_, filename, _, ok := runtime.Caller(0)
|
||||
if ok {
|
||||
path = filepath.Dir(filename) + "/" + path
|
||||
}
|
||||
|
||||
return path + file
|
||||
}
|
||||
15
test/json.go
15
test/json.go
@@ -1,15 +0,0 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
)
|
||||
|
||||
func ReadFile(file string) []byte {
|
||||
data, err := ioutil.ReadFile(FixturePath(file))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
@@ -39,8 +39,6 @@ type Read struct {
|
||||
Assert func(t *testing.T, v config.Value)
|
||||
}
|
||||
|
||||
const ConfigJSON = `{"duration":1260000000000,"enabled":true}`
|
||||
|
||||
type Config struct {
|
||||
Duration time.Duration
|
||||
Enabled bool
|
||||
|
||||
Reference in New Issue
Block a user