initial
This commit is contained in:
31
parser_test.go
Normal file
31
parser_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var testConf = []byte(`network
|
||||
server=10.0.0.10
|
||||
port=10000
|
||||
token=test
|
||||
editor=vim
|
||||
color`)
|
||||
|
||||
func TestParser(t *testing.T) {
|
||||
r := bytes.NewReader(testConf)
|
||||
c := parseReader(r)
|
||||
if c.Get("token") != "test" {
|
||||
fmt.Println("failed finding key value")
|
||||
t.Fail()
|
||||
}
|
||||
if c.GetInt("port") != 10000 {
|
||||
fmt.Println("failed finding int")
|
||||
t.Fail()
|
||||
}
|
||||
if c.GetBool("color") != true {
|
||||
fmt.Println("failed finding bool")
|
||||
t.Fail()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user