Update flow_test.go
This commit is contained in:
parent
f8e97545c1
commit
26e1267f6c
@ -5,33 +5,32 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMarshall(t *testing.T) {
|
||||
a := "json"
|
||||
res := []byte(a)
|
||||
m := RawMessage(a)
|
||||
func FuzzMarshall(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, ref []byte) {
|
||||
rm := RawMessage(ref)
|
||||
|
||||
b, err := m.MarshalJSON()
|
||||
b, err := rm.MarshalJSON()
|
||||
if err != nil {
|
||||
t.Errorf("Error %s", err)
|
||||
t.Errorf("Error MarshalJSON: %s", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(b, res) {
|
||||
t.Errorf("Error %s", err)
|
||||
if !reflect.DeepEqual(ref, b) {
|
||||
t.Errorf("Error. Expected '%s', was '%s'", ref, b)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
func TestUnmarshall(t *testing.T) {
|
||||
strn := "json"
|
||||
b := []byte(strn)
|
||||
// exp := string(b)
|
||||
m := RawMessage(b)
|
||||
func FuzzUnmarshall(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, ref string) {
|
||||
b := []byte(ref)
|
||||
rm := RawMessage(b)
|
||||
|
||||
if err := m.UnmarshalJSON(b); err != nil {
|
||||
t.Errorf("Error %s", m)
|
||||
if err := rm.UnmarshalJSON(b); err != nil {
|
||||
t.Errorf("Error UnmarshalJSON: %s", err)
|
||||
}
|
||||
|
||||
if string(m) != strn {
|
||||
t.Errorf("Error %s", m)
|
||||
if ref != string(rm) {
|
||||
t.Errorf("Error. Expected '%s', was '%s'", ref, rm)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user