summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/hashicorp/hcl/lex_test.go
blob: 8062764446b7be1173fb19b7d81f8a9a2e054bd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)
		}
	}
}