You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
404 B
37 lines
404 B
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)
|
|
}
|
|
}
|
|
}
|
|
|