Exemple #1
0
func main() {
	flag.Parse()
	if *inputFile == "" {
		log.Fatal("No input file specified")
	}
	if *outputFile == "" {
		*outputFile = *inputFile + ".gen.go"
	}

	f, err := os.Open(*inputFile)
	if err != nil {
		log.Fatal(err)
	}
	defer f.Close()

	s, err := schema.Parse(f)
	if err != nil {
		log.Fatal(err)
	}

	if *debug {
		pretty.Print(s)
	}

	output, _ := os.Create(*outputFile)
	s.(schema.Schema).Generate(output, *packageFile)
}
Exemple #2
0
func TestFuzz3(t *testing.T) {
	input := strings.NewReader("chitin\nv1message\n0\nv0{slots{0\nstring")
	_, _ = schema.Parse(input)
}
Exemple #3
0
func TestFuzz1(t *testing.T) {
	input := strings.NewReader("chitin\tv1message 0\tv0{slots{}")
	_, _ = schema.Parse(input)
}
Exemple #4
0
func TestFuzz2(t *testing.T) {
	input := strings.NewReader("chitin\tv1envelope\t0{}")
	_, _ = schema.Parse(input)
}