MCPcopy
hub / github.com/dnote/dnote / MustMarshalJSON

Function MustMarshalJSON

pkg/cli/testutils/main.go:275–282  ·  view source on GitHub ↗

MustMarshalJSON marshalls the given interface into JSON. If there is any error, it fails the test.

(t *testing.T, v interface{})

Source from the content-addressed store, hash-verified

273// MustMarshalJSON marshalls the given interface into JSON.
274// If there is any error, it fails the test.
275func MustMarshalJSON(t *testing.T, v interface{}) []byte {
276 b, err := json.Marshal(v)
277 if err != nil {
278 t.Fatalf("%s: marshalling data: %s", t.Name(), err.Error())
279 }
280
281 return b
282}
283
284// MustUnmarshalJSON marshalls the given interface into JSON.
285// If there is any error, it fails the test.

Callers 6

TestSignInFunction · 0.92
TestLocalMigration1Function · 0.92
TestLocalMigration2Function · 0.92
TestLocalMigration3Function · 0.92
TestLocalMigration5Function · 0.92
TestLocalMigration6Function · 0.92

Calls 1

ErrorMethod · 0.45

Tested by 6

TestSignInFunction · 0.74
TestLocalMigration1Function · 0.74
TestLocalMigration2Function · 0.74
TestLocalMigration3Function · 0.74
TestLocalMigration5Function · 0.74
TestLocalMigration6Function · 0.74