summaryrefslogtreecommitdiff
path: root/lib/lowmemjson.stock/borrowed_tags_test.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-08-01 00:18:59 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-08-01 00:44:08 -0600
commit14bb92b622d5cd56829d0d9f04a201c7260ff9f9 (patch)
tree2a808d1e1f6acd8315e6306beeaf61f33890f3aa /lib/lowmemjson.stock/borrowed_tags_test.go
parent0ee3e4eb97aba57735b1278e2afb3df5e7d7ee56 (diff)
wip
Diffstat (limited to 'lib/lowmemjson.stock/borrowed_tags_test.go')
-rw-r--r--lib/lowmemjson.stock/borrowed_tags_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/lowmemjson.stock/borrowed_tags_test.go b/lib/lowmemjson.stock/borrowed_tags_test.go
new file mode 100644
index 0000000..8ba8ddd
--- /dev/null
+++ b/lib/lowmemjson.stock/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 json
+
+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)
+ }
+ }
+}