Sha256: 47b68ae8f0411159e37339a00cd8b7003cfe20ba00e0124bcdf5412bb8a9450a
Contents?: true
Size: 718 Bytes
Versions: 27
Compression:
Stored size: 718 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("luhn", &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 bool } } // template applied to above data structure generates the Go test cases var tmpl = `package luhn {{.Header}} var testCases = []struct { description string input string ok bool }{ {{range .J.Cases}}{ {{printf "%q" .Description}}, {{printf "%q" .Input}}, {{.Expected}}, }, {{end}} }`
Version data entries
27 entries across 27 versions & 1 rubygems