38 lines
396 B
Go
38 lines
396 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(tc.Input)
|
|
|
|
if actual != tc.Mode {
|
|
t.Fatalf("%d: %#v", i, actual)
|
|
}
|
|
}
|
|
}
|