aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/decode_test.go')
-rw-r--r--src/encoding/json/decode_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go
index 5bc3d3c856..473fd02833 100644
--- a/src/encoding/json/decode_test.go
+++ b/src/encoding/json/decode_test.go
@@ -1189,6 +1189,27 @@ var unmarshalTests = []struct {
out: []int{1, 2, 0, 4, 5},
err: &UnmarshalTypeError{Value: "bool", Type: reflect.TypeFor[int](), Offset: 9},
},
+
+ {
+ CaseName: Name("DashComma"),
+ in: `{"-":"hello"}`,
+ ptr: new(struct {
+ F string `json:"-,"`
+ }),
+ out: struct {
+ F string `json:"-,"`
+ }{"hello"},
+ },
+ {
+ CaseName: Name("DashCommaOmitEmpty"),
+ in: `{"-":"hello"}`,
+ ptr: new(struct {
+ F string `json:"-,omitempty"`
+ }),
+ out: struct {
+ F string `json:"-,omitempty"`
+ }{"hello"},
+ },
}
func TestMarshal(t *testing.T) {