Retro68/gcc/libgo/go/internal/trace/parser_test.go
2017-04-10 13:32:00 +02:00

31 lines
750 B
Go

// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package trace
import (
"strings"
"testing"
)
func TestCorruptedInputs(t *testing.T) {
// These inputs crashed parser previously.
tests := []string{
"gotrace\x00\x020",
"gotrace\x00Q00\x020",
"gotrace\x00T00\x020",
"gotrace\x00\xc3\x0200",
"go 1.5 trace\x00\x00\x00\x00\x020",
"go 1.5 trace\x00\x00\x00\x00Q00\x020",
"go 1.5 trace\x00\x00\x00\x00T00\x020",
"go 1.5 trace\x00\x00\x00\x00\xc3\x0200",
}
for _, data := range tests {
events, err := Parse(strings.NewReader(data))
if err == nil || events != nil {
t.Fatalf("no error on input: %q\n", data)
}
}
}