Sha256: fb649ddf24f0b3e338d58535ba8ed837a09deab12e34acedb988d2a14dab2c74
Contents?: true
Size: 841 Bytes
Versions: 30
Compression:
Stored size: 841 Bytes
Contents
package main import ( "log" "text/template" "../../../gen" ) func main() { t, err := template.New("").Parse(tmpl) if err != nil { log.Fatal(err) } var j js if err := gen.Gen("flatten-array", &j, t); err != nil { log.Fatal(err) } } // The JSON structure we expect to be able to unmarshal into type js struct { Exercise string Version string Cases []oneCase } // Test cases type oneCase struct { Description string Property string Input interface{} Expected []interface{} } // Template to generate test cases. var tmpl = `package flatten {{.Header}} var testCases = []struct { description string input interface{} expected []interface{} }{ {{range .J.Cases}} { description: {{printf "%q" .Description}}, input: {{printf "%#v" .Input}}, expected: {{printf "%#v" .Expected}}, },{{end}} } `
Version data entries
30 entries across 30 versions & 1 rubygems