...

Source file src/github.com/hashicorp/hcl/lex_test.go

Documentation: github.com/hashicorp/hcl

     1  package hcl
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestLexMode(t *testing.T) {
     8  	cases := []struct {
     9  		Input string
    10  		Mode  lexModeValue
    11  	}{
    12  		{
    13  			"",
    14  			lexModeHcl,
    15  		},
    16  		{
    17  			"foo",
    18  			lexModeHcl,
    19  		},
    20  		{
    21  			"{}",
    22  			lexModeJson,
    23  		},
    24  		{
    25  			"  {}",
    26  			lexModeJson,
    27  		},
    28  	}
    29  
    30  	for i, tc := range cases {
    31  		actual := lexMode([]byte(tc.Input))
    32  
    33  		if actual != tc.Mode {
    34  			t.Fatalf("%d: %#v", i, actual)
    35  		}
    36  	}
    37  }
    38  

View as plain text