blob: 03f0b110058f98facd581c35efcda9541e86c991 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package planr
import (
"github.com/BurntSushi/toml"
)
// Test adapters must implement all life cycle hooks
// This allows common config, code generation, etc
// Test cases matching adapter configurations will be
// fed into the adapter interface
type Adapter interface {
Config() AdapterConfig
Init(ctx PipelineContext)
// Called once to preform expensive code generation
Build(testCase []TestCase)
// Called every time source changes
Evaluate(testCase []TestCase) []TestResult
}
// Additional information required during the build / evaluation stages
type PipelineContext struct {
Dirs DirConfig
AdapterDir string
}
// A parser function takes a blob of TOML and decodes it into
// configuration relevant to an adapter
type TomlParser func (toml.Primitive) (InheritableConfig, error)
// The name under which an adapter registers corresponds
// to a table under the super-table adapters. All corresponding
// TOML will be passed to the ParseConfig method or ParseDefaultConfig
// for parsing. The ParseConfig file parses options in test case files.
// The ParseDefaultConfig is parsed by `defaults.toml` files and can
// be used to establish default configuration that will be inherited
// by all units in a common directory (collection)
type AdapterConfig struct {
Name string
ParseConfig TomlParser
ParseDefaultConfig TomlParser
}
|