micro/flow/flow_test.go
Aleksandr Tolstikhin f8e97545c1
All checks were successful
pr / test (pull_request) Successful in 1m45s
lint / lint (pull_request) Successful in 9m59s
Go / test (pull_request) Successful in 11m11s
Add flow/flow_test
2024-09-13 00:23:54 +07:00

38 lines
520 B
Go

package flow
import (
"reflect"
"testing"
)
func TestMarshall(t *testing.T) {
a := "json"
res := []byte(a)
m := RawMessage(a)
b, err := m.MarshalJSON()
if err != nil {
t.Errorf("Error %s", err)
}
if !reflect.DeepEqual(b, res) {
t.Errorf("Error %s", err)
}
}
func TestUnmarshall(t *testing.T) {
strn := "json"
b := []byte(strn)
// exp := string(b)
m := RawMessage(b)
if err := m.UnmarshalJSON(b); err != nil {
t.Errorf("Error %s", m)
}
if string(m) != strn {
t.Errorf("Error %s", m)
}
}