Run runs the ztests in the directory named dirname. For each file f.yaml in the directory, Run calls FromYAMLFile to load a ztest and then runs it in subtest named f. path is a command search path like the PATH environment variable.
(t *testing.T, dirname string)
| 186 | // subtest named f. path is a command search path like the |
| 187 | // PATH environment variable. |
| 188 | func Run(t *testing.T, dirname string) { |
| 189 | shellPath := ShellPath() |
| 190 | bundles, err := Load(dirname) |
| 191 | if err != nil { |
| 192 | t.Fatal(err) |
| 193 | } |
| 194 | for _, b := range bundles { |
| 195 | name := filepath.Base(b.FileName) |
| 196 | if z := b.Test; z != nil { |
| 197 | name = fmt.Sprintf("%s/%d", name, z.Line) |
| 198 | } |
| 199 | t.Run(name, func(t *testing.T) { |
| 200 | t.Parallel() |
| 201 | if b.Error != nil { |
| 202 | t.Fatalf("%s: %s", b.FileName, b.Error) |
| 203 | } |
| 204 | b.Test.Run(t, shellPath, b.FileName) |
| 205 | }) |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | type File struct { |
| 210 | // Name is the name of the file with respect to the directoy in which |