WIP - Command line tool

This commit is contained in:
tim
2017-09-06 02:40:24 +02:00
parent 1c9a9d60b1
commit b478d6efe8
6 changed files with 329 additions and 119 deletions

37
config/config_test.go Normal file
View File

@@ -0,0 +1,37 @@
package config_test
import (
"testing"
"bitbucket.org/digitorus/littlewatcher/src/config"
"github.com/BurntSushi/toml"
"github.com/stretchr/testify/assert"
)
func TestConfig(t *testing.T) {
const configContent = `
staticPath = "../static"
`
var c config.Config
if _, err := toml.Decode(configContent, &c); err != nil {
t.Error(err)
}
// Root
assert.Equal(t, "../static", c.StaticPath)
}
func TestValidation(t *testing.T) {
const configContent = ``
var c config.Config
if _, err := toml.Decode(configContent, &c); err != nil {
t.Error(err)
}
err := c.ValidateFields()
assert.NotNil(t, err)
}