| 12345678910111213141516171819202122232425262728 |
- package common
- import (
- "fmt"
- "testing"
- )
- var (
- testObj = map[string]interface{}{"k1": "v1", "k2": "v2", "k3": []int{1, 2, 3, 4}}
- )
- func TestMarshalJsonFormat(t *testing.T) {
- jb, err := MarshalJsonFormat(testObj)
- if err != nil {
- t.Fatal(err)
- }
- fmt.Println(string(jb))
- }
- func TestMarshalJsonFormatIgnoreError(t *testing.T) {
- jb := MarshalJsonFormatIgnoreError(testObj)
- fmt.Println(string(jb))
- }
- func TestMarshalJsonIgnoreError(t *testing.T) {
- jb := MarshalJsonIgnoreError(testObj)
- fmt.Println(string(jb))
- }
|