Newer
Older
pokemon-go-trade / vendor / github.com / hashicorp / hcl / lex_test.go
Simon Lindgren on 12 Feb 2021 404 bytes first commit
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)
		}
	}
}