FromYAMLFile loads ztests from the named YAML file.
(name string)
| 308 | |
| 309 | // FromYAMLFile loads ztests from the named YAML file. |
| 310 | func FromYAMLFile(name string) ([]*ZTest, error) { |
| 311 | f, err := yamlparser.ParseFile(name, 0) |
| 312 | if err != nil { |
| 313 | return nil, err |
| 314 | } |
| 315 | var zs []*ZTest |
| 316 | for _, d := range f.Docs { |
| 317 | var z ZTest |
| 318 | if err := yaml.NodeToValue(d.Body, &z, yaml.DisallowUnknownField()); err != nil { |
| 319 | return nil, err |
| 320 | } |
| 321 | if s := d.Start; s != nil { |
| 322 | // s is a YAML directives end marker ("---"). |
| 323 | z.Line = s.Position.Line + 1 |
| 324 | } else { |
| 325 | z.Line = 1 |
| 326 | } |
| 327 | zs = append(zs, &z) |
| 328 | } |
| 329 | return zs, nil |
| 330 | } |
| 331 | |
| 332 | func (z *ZTest) ShouldSkip(path string) string { |
| 333 | switch { |
no outgoing calls