mirror of
https://github.com/gwoo/goforever.git
synced 2025-09-26 19:41:10 +08:00
39 lines
780 B
Go
39 lines
780 B
Go
// goforever - processes management
|
|
// Copyright (c) 2013 Garrett Woodworth (https://github.com/gwoo).
|
|
|
|
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestNewConfig(t *testing.T) {
|
|
r, err := LoadConfig("goforever.toml")
|
|
|
|
if err != nil {
|
|
t.Errorf("Error creating config %s.", err)
|
|
return
|
|
}
|
|
if r == nil {
|
|
t.Errorf("Expected %#v. Result %#v\n", r, nil)
|
|
}
|
|
}
|
|
|
|
func TestConfigGet(t *testing.T) {
|
|
c, _ := LoadConfig("goforever.toml")
|
|
ex := "example/example.pid"
|
|
r := string(c.Get("example").Pidfile)
|
|
if ex != r {
|
|
t.Errorf("Expected %#v. Result %#v\n", ex, r)
|
|
}
|
|
}
|
|
|
|
func TestConfigKeys(t *testing.T) {
|
|
c, _ := LoadConfig("goforever.toml")
|
|
ex := []string{"example", "example-panic"}
|
|
r := c.Keys()
|
|
if len(ex) != len(r) {
|
|
t.Errorf("Expected %#v. Result %#v\n", ex, r)
|
|
}
|
|
}
|