summaryrefslogtreecommitdiff
path: root/compat/json/borrowed_tags_test.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2022-08-15 00:22:04 -0600
committerLuke Shumaker <lukeshu@datawire.io>2022-08-15 00:28:27 -0600
commit25d0b8365020ef4051dffd4f7704328402914613 (patch)
treec84662fd6431bd79559cfa9a7e3e2a7b75302867 /compat/json/borrowed_tags_test.go
parentc11411d3591de78417f9ded2ca443c366f92367e (diff)
mkdir -p compat/json && mv borrowed_*_test.go compat/json/ # [ci-skip]
Diffstat (limited to 'compat/json/borrowed_tags_test.go')
-rw-r--r--compat/json/borrowed_tags_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/compat/json/borrowed_tags_test.go b/compat/json/borrowed_tags_test.go
new file mode 100644
index 0000000..28d76e9
--- /dev/null
+++ b/compat/json/borrowed_tags_test.go
@@ -0,0 +1,28 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package lowmemjson // MODIFIED
+
+import (
+ "testing"
+)
+
+func TestTagParsing(t *testing.T) {
+ name, opts := parseTag("field,foobar,foo")
+ if name != "field" {
+ t.Fatalf("name = %q, want field", name)
+ }
+ for _, tt := range []struct {
+ opt string
+ want bool
+ }{
+ {"foobar", true},
+ {"foo", true},
+ {"bar", false},
+ } {
+ if opts.Contains(tt.opt) != tt.want {
+ t.Errorf("Contains(%q) = %v", tt.opt, !tt.want)
+ }
+ }
+}