File: raw_message_test.go

package info (click to toggle)
golang-github-json-iterator-go 1.1.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 916 kB
  • sloc: sh: 19; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 524 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package test

import (
	"encoding/json"
)

func init() {
	marshalCases = append(marshalCases,
		json.RawMessage("{}"),
		json.RawMessage("12345"),
		json.RawMessage("3.14"),
		json.RawMessage("-0.5e10"),
		struct {
			Env   string          `json:"env"`
			Extra json.RawMessage `json:"extra,omitempty"`
		}{
			Env: "jfdk",
		},
	)
	unmarshalCases = append(unmarshalCases, unmarshalCase{
		ptr:   (*json.RawMessage)(nil),
		input: `[1,2,3]`,
	}, unmarshalCase{
		ptr:   (*json.RawMessage)(nil),
		input: `1.122e+250`,
	})
}