Files
upstream-centrifugo/internal/apiproto/raw_test.go
upstream-mirror b352a9a30d
Some checks failed
test / Lint (push) Failing after 3s
test / Test with Go 1.26.8 (push) Failing after 2s
snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:17:21 +05:00

36 lines
566 B
Go

package apiproto
import (
"encoding/json"
"testing"
)
type DataRawMessage struct {
Data *json.RawMessage
}
type DataRaw struct {
Data *Raw
}
func TestRaw(t *testing.T) {
data1 := json.RawMessage(`{"key": "value"}`)
stdJsonData1, err := json.Marshal(DataRawMessage{
Data: &data1,
})
if err != nil {
t.Fatalf("%v", err)
}
data2 := Raw(`{"key": "value"}`)
stdJsonData2, err := json.Marshal(DataRaw{
Data: &data2,
})
if err != nil {
t.Fatalf("%v", err)
}
if string(stdJsonData1) != string(stdJsonData2) {
t.Fatalf("no match: %v", err)
}
}