mirror of https://github.com/go-gitea/gitea.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
569 B
28 lines
569 B
// Copyright 2025 The Gitea Authors. All rights reserved. |
|
// SPDX-License-Identifier: MIT |
|
|
|
package json |
|
|
|
import ( |
|
"bytes" |
|
"testing" |
|
|
|
"github.com/stretchr/testify/assert" |
|
) |
|
|
|
func TestGiteaDBJSONUnmarshal(t *testing.T) { |
|
var m map[any]any |
|
err := UnmarshalHandleDoubleEncode(nil, &m) |
|
assert.NoError(t, err) |
|
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()) |
|
}
|
|
|