2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-20 16:45:22 +08:00
sonic/ast/api_amd64_test.go
Yi Duan 67cffb15bd
feat:(ast) add fallback api on not-amd64 env (#341)
* feat:(ast) add  fallback api on `not-amd64` env

* test: add native `linux-arm64` CI

* opt: just skip number chars whne `decodeFloat64`

* fmt

* fix: check EOF
2023-01-03 19:47:55 +08:00

34 lines
No EOL
725 B
Go

//go:build amd64
// +build amd64
package ast
import (
`testing`
`github.com/bytedance/sonic/encoder`
`github.com/stretchr/testify/assert`
)
func TestSortNodeTwitter(t *testing.T) {root, err := NewSearcher(_TwitterJson).GetByPath()
if err != nil {
t.Fatal(err)
}
obj, err := root.MapUseNumber()
if err != nil {
t.Fatal(err)
}
exp, err := encoder.Encode(obj, encoder.SortMapKeys)
if err != nil {
t.Fatal(err)
}
if err := root.SortKeys(true); err != nil {
t.Fatal(err)
}
act, err := root.MarshalJSON()
if err != nil {
t.Fatal(err)
}
assert.Equal(t, len(exp), len(act))
assert.Equal(t, string(exp), string(act))
}