Home | History | Annotate | Download | only in json
      1 // Copyright 2011 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package json
      6 
      7 import (
      8 	"testing"
      9 )
     10 
     11 func TestTagParsing(t *testing.T) {
     12 	name, opts := parseTag("field,foobar,foo")
     13 	if name != "field" {
     14 		t.Fatalf("name = %q, want field", name)
     15 	}
     16 	for _, tt := range []struct {
     17 		opt  string
     18 		want bool
     19 	}{
     20 		{"foobar", true},
     21 		{"foo", true},
     22 		{"bar", false},
     23 	} {
     24 		if opts.Contains(tt.opt) != tt.want {
     25 			t.Errorf("Contains(%q) = %v", tt.opt, !tt.want)
     26 		}
     27 	}
     28 }
     29