File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
internal/build/cmd/generate/commands/gentests Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -695,7 +695,8 @@ default:
695695 // We cannot reliably serialize to json and compare the json outputs: YAML responses are parsed as
696696 // a map[interface{}]interface{} that encoding/json fails to marshall
697697 // See https://play.golang.org/p/jhcXwg5dIrn
698- expectedPayload := flattenPayload (val )
698+ expectedOutput := flattenPayload (val )
699+ expectedPayload := fmt .Sprintf ("%#v" , expectedOutput )
699700
700701 expectedPayload = strings .ReplaceAll (expectedPayload , "map[interface {}]interface {}" , "map[string]interface {}" )
701702 output = ` actual = fmt.Sprintf("%v",` + escape (subject ) + `)
@@ -940,7 +941,7 @@ func skipVersion(minmax string) bool {
940941}
941942
942943// flattenPayload serializes the expected payload as a map tree to compare within tests.
943- func flattenPayload (val interface {}) string {
944+ func flattenPayload (val interface {}) map [ string ] interface {} {
944945 expectedOutput := make (map [string ]interface {})
945946 if cast , ok := val .(map [interface {}]interface {}); ok {
946947 for k , v := range cast {
@@ -952,5 +953,5 @@ func flattenPayload(val interface{}) string {
952953 } else {
953954 expectedOutput = val .(map [string ]interface {})
954955 }
955- return fmt . Sprintf ( "%#v" , expectedOutput )
956+ return expectedOutput
956957}
You can’t perform that action at this time.
0 commit comments