Sha256: 67bcea8bb9e470ba86bab336bf98939f9f694d7ada3af4b59c6bc92b39903ee4
Contents?: true
Size: 739 Bytes
Versions: 16
Compression:
Stored size: 739 Bytes
Contents
// +build ignore 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("bob", &j, t); err != nil { log.Fatal(err) } } // The JSON structure we expect to be able to unmarshal into type js struct { Cases []struct { Description string Input string Expected string } } // template applied to above data structure generates the Go test cases var tmpl = `package bob {{.Header}} var testCases = []struct { description string input string expected string }{ {{range .J.Cases}}{ {{printf "%q" .Description}}, {{printf "%q" .Input}}, {{printf "%q" .Expected}}, }, {{end}}} `
Version data entries
16 entries across 16 versions & 1 rubygems