diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-09-05 20:37:19 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-09-05 20:37:19 -0500 |
commit | f5b60238e05b124eb40f805eb4a0bbfc0b043da5 (patch) | |
tree | f461bff108f5ddafc4078aa7394d7bf2a6309cc9 /adapters.go | |
parent | 8f22bd4f5b4eb6996c524bcb6948d36cef0ac822 (diff) | |
parent | fd66fb134967067ed7e1c3182325f646b73c730b (diff) | |
download | deb-planr-f5b60238e05b124eb40f805eb4a0bbfc0b043da5.tar.xz deb-planr-f5b60238e05b124eb40f805eb4a0bbfc0b043da5.zip |
Merge branch 'upstream' into ppa
Merge v0.1.0
Diffstat (limited to 'adapters.go')
-rw-r--r-- | adapters.go | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/adapters.go b/adapters.go index 8419c8b..f6c48cb 100644 --- a/adapters.go +++ b/adapters.go @@ -1,16 +1,38 @@ 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(dirs DirConfig) + // Called once to preform expensive code generation - Build(testCase []*TestCase) + Build(testCase []TestCase) // Called every time source changes - Evaluate(testCase []*TestCase) + Evaluate(testCase []TestCase) []TestResult +} + +// 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 } |