use experimental go json v2 library (#35392)

details: https://pkg.go.dev/encoding/json/v2

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
junoberryferry
2025-09-28 04:03:36 -04:00
committed by GitHub
parent 8106d95577
commit 151ef80e28
19 changed files with 240 additions and 37 deletions

View File

@@ -4,6 +4,7 @@
package json
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
@@ -16,3 +17,12 @@ func TestGiteaDBJSONUnmarshal(t *testing.T) {
err = UnmarshalHandleDoubleEncode([]byte(""), &m)
assert.NoError(t, err)
}
func TestIndent(t *testing.T) {
buf := &bytes.Buffer{}
err := Indent(buf, []byte(`{"a":1}`), ">", " ")
assert.NoError(t, err)
assert.Equal(t, `{
> "a": 1
>}`, buf.String())
}