Sha256: a6dd2b6831cee7ab5276a5c6472765968b013864aed028a046fd2ccca97b6a16
Contents?: true
Size: 878 Bytes
Versions: 46
Compression:
Stored size: 878 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("isogram", &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 []struct { Description string Cases []oneCase } } // Test cases type oneCase struct { Description string Property string Input string Expected bool } // Template to generate test cases. var tmpl = `package isogram {{.Header}} var testCases = []struct { description string input string expected bool }{ {{range .J.Cases}} {{range .Cases}} { description: {{printf "%q" .Description}}, input: {{printf "%q" .Input}}, expected: {{printf "%t" .Expected}}, },{{end}}{{end}} } `
Version data entries
46 entries across 46 versions & 1 rubygems