Sha256: 0c690fa7d7cd56cbeaa15a919ce889264c44fb8b41c69ad23b94f94956bdd918
Contents?: true
Size: 969 Bytes
Versions: 77
Compression:
Stored size: 969 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("sublist", &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 struct { ListOne []int `json:"listOne"` ListTwo []int `json:"listTwo"` } Expected sublist.Relation } // Template to generate test cases. var tmpl = `package sublist {{.Header}} var testCases = []struct { description string listOne []int listTwo []int expected Relation }{ {{range .J.Cases}} { description: {{printf "%q" .Description}}, listOne: {{printf "%#v" .Input.ListOne}}, listTwo: {{printf "%#v" .Input.ListTwo}}, expected: {{printf "%#v" .Expected}}, },{{end}} } `
Version data entries
77 entries across 77 versions & 1 rubygems