hcl/lex_test.go
Drew Wells 2799afc14b adds std encoding API fixes #4
The std encoding format is Unmarshal([]byte, interface{}) error.
This naturally lends itself well to being passed readfile or exhausted
reader/buffer.
2016-03-10 15:36:44 -05:00

38 lines
404 B
Go

package hcl
import (
"testing"
)
func TestLexMode(t *testing.T) {
cases := []struct {
Input string
Mode lexModeValue
}{
{
"",
lexModeHcl,
},
{
"foo",
lexModeHcl,
},
{
"{}",
lexModeJson,
},
{
" {}",
lexModeJson,
},
}
for i, tc := range cases {
actual := lexMode([]byte(tc.Input))
if actual != tc.Mode {
t.Fatalf("%d: %#v", i, actual)
}
}
}