MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / TestTextMarshal

Function TestTextMarshal

http/marshaller_test.go:8–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestTextMarshal(t *testing.T) {
9 dataSet := []interface{}{
10 42,
11 int8(42),
12 int16(42),
13 int32(42),
14 int64(42),
15 uint(42),
16 uint8(42),
17 uint16(42),
18 uint32(42),
19 uint64(42),
20 "42",
21 testData{},
22 &testData{},
23 }
24
25 marshaller := &textMarshaller{}
26 for _, v := range dataSet {
27 t.Run(reflect.TypeOf(v).Name(), func(t *testing.T) {
28 result, err := marshaller.Marshal(v)
29 if err != nil {
30 t.Fatal(err)
31 }
32 if string(result) != "42" {
33 t.Fatalf("unexpected marshal result: %s", result)
34 }
35 })
36 }
37}
38
39type testData struct{}
40

Callers

nothing calls this directly

Calls 5

MarshalMethod · 0.95
FatalMethod · 0.80
FatalfMethod · 0.80
RunMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected