MCPcopy Index your code
hub / github.com/dunglas/httpsfv / TestMarshal

Function TestMarshal

encode_test.go:8–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestMarshal(t *testing.T) {
9 t.Parallel()
10
11 i := NewItem(22.1)
12 i.Params.Add("foo", true)
13 i.Params.Add("bar", Token("baz"))
14
15 d := NewDictionary()
16 d.Add("i", i)
17
18 tok := NewItem(Token("foo"))
19 tok.Params.Add("a", "b")
20 d.Add("tok", tok)
21
22 date := NewItem(time.Date(1988, 21, 01, 0, 0, 0, 0, time.UTC))
23 d.Add("d", date)
24
25 if res, _ := Marshal(d); res != `i=22.1;foo;bar=baz, tok=foo;a="b", d=@620611200` {
26 t.Errorf("marshal: bad result: %q", res)
27 }
28}
29
30func TestMarshalError(t *testing.T) {
31 t.Parallel()

Callers

nothing calls this directly

Calls 6

AddMethod · 0.95
NewItemFunction · 0.85
TokenTypeAlias · 0.85
NewDictionaryFunction · 0.85
MarshalFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…