Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package utils_test
import (
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestJSONClone(t *testing.T) {
type A struct {
B int `json:"b"`
C string `json:"c"`
}
var a = &A{B: 123, C: "456"}
for i := 0; i < 5; i++ {
c, err := utils.JSONClone(a)
if err != nil {
t.Fatal(err)
}
t.Logf("%p, %#v", c, c)
}
}
func TestJSONIsNull(t *testing.T) {
var a = assert.NewAssertion(t)
a.IsTrue(utils.JSONIsNull(nil))
a.IsTrue(utils.JSONIsNull([]byte{}))
a.IsTrue(utils.JSONIsNull([]byte("null")))
a.IsFalse(utils.JSONIsNull([]byte{1, 2, 3}))
}