Damien Neil | 26451c0 | 2019-12-19 14:17:21 -0800 | [diff] [blame^] | 1 | // Copyright 2019 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package textfuzz |
| 6 | |
| 7 | import ( |
| 8 | "io/ioutil" |
| 9 | "os" |
| 10 | "path/filepath" |
| 11 | "testing" |
| 12 | ) |
| 13 | |
| 14 | func Test(t *testing.T) { |
| 15 | dir, err := os.Open("corpus") |
| 16 | if err != nil { |
| 17 | t.Fatal(err) |
| 18 | } |
| 19 | infos, err := dir.Readdir(0) |
| 20 | if err != nil { |
| 21 | t.Fatal(err) |
| 22 | |
| 23 | } |
| 24 | for _, info := range infos { |
| 25 | name := info.Name() |
| 26 | t.Run(name, func(t *testing.T) { |
| 27 | b, err := ioutil.ReadFile(filepath.Join("corpus", name)) |
| 28 | if err != nil { |
| 29 | t.Fatal(err) |
| 30 | } |
| 31 | Fuzz(b) |
| 32 | }) |
| 33 | } |
| 34 | } |