...

Source file src/github.com/hashicorp/hcl/json/token/token_test.go

Documentation: github.com/hashicorp/hcl/json/token

     1  package token
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestTypeString(t *testing.T) {
     8  	var tokens = []struct {
     9  		tt  Type
    10  		str string
    11  	}{
    12  		{ILLEGAL, "ILLEGAL"},
    13  		{EOF, "EOF"},
    14  		{NUMBER, "NUMBER"},
    15  		{FLOAT, "FLOAT"},
    16  		{BOOL, "BOOL"},
    17  		{STRING, "STRING"},
    18  		{NULL, "NULL"},
    19  		{LBRACK, "LBRACK"},
    20  		{LBRACE, "LBRACE"},
    21  		{COMMA, "COMMA"},
    22  		{PERIOD, "PERIOD"},
    23  		{RBRACK, "RBRACK"},
    24  		{RBRACE, "RBRACE"},
    25  	}
    26  
    27  	for _, token := range tokens {
    28  		if token.tt.String() != token.str {
    29  			t.Errorf("want: %q got:%q\n", token.str, token.tt)
    30  
    31  		}
    32  	}
    33  
    34  }
    35  

View as plain text