packagecommandsimport"testing"typeTestOutputstruct{Foo,BarstringBazint}funcTestMarshalling(t*testing.T){req:=NewRequest()res:=Response{req:req,Value:TestOutput{"beep","boop",1337},}_,err:=res.Marshal()iferr==nil{t.Error("Should have failed (no encoding type specified in request)")}req.options["enc"]=Jsonbytes,err:=res.Marshal()iferr!=nil{t.Error("Should have passed")}output:=string(bytes)ifoutput!="{\"Foo\":\"beep\",\"Bar\":\"boop\",\"Baz\":1337}"{t.Error("Incorrect JSON output")}}