From 14bb92b622d5cd56829d0d9f04a201c7260ff9f9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 1 Aug 2022 00:18:59 -0600 Subject: wip --- lib/lowmemjson.stock/borrowed_tags_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/lowmemjson.stock/borrowed_tags_test.go (limited to 'lib/lowmemjson.stock/borrowed_tags_test.go') 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) + } + } +} -- cgit v1.2.3-2-g168b