File: lex_test.go

package info (click to toggle)
golang-github-hashicorp-hcl 0.0~git20161215.0.80e628d-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch, stretch-backports
  • size: 948 kB
  • sloc: makefile: 22
file content (37 lines) | stat: -rw-r--r-- 404 bytes parent folder | download | duplicates (3)
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)
		}
	}
}