Delta Between Two Patch Sets: src/pkg/json/tags_test.go
Issue 4918051 :
code review 4918051: json: add struct tag option to wrap literals in strings (Closed)
Left Patch Set: diff -r 7860bad4407f https://go.googlecode.com/hg/
Right Patch Set: diff -r 73c091a3fc96 https://go.googlecode.com/hg
Use n/p to move between diff chunks;
N/P to move between comments.
Please Sign in to add in-line comments.
Jump to:
src/pkg/json/Makefile
src/pkg/json/decode.go
src/pkg/json/decode_test.go
src/pkg/json/encode.go
src/pkg/json/encode_test.go
src/pkg/json/tags.go
src/pkg/json/tags_test.go
LEFT RIGHT
(no file at all) 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 }
LEFT RIGHT