package adapters import ( "fmt" "github.com/BurntSushi/toml" "golang.flu0r1ne.net/planr" "log" ) /* CONFIGURATION */ type GtestDefaults struct { Name *string Suite *string File *string } func (child *GtestDefaults) Inherit(p interface{}) { parent := p.(*GtestDefaults) if(child.Name == nil) { child.Name = parent.Name } if(child.Suite == nil) { child.Suite = parent.Suite } if(child.File == nil) { child.File = parent.File } } type GtestConfig struct { GtestDefaults } func primitiveDecode(primitive toml.Primitive, config interface{}) { if err := toml.PrimitiveDecode(primitive, config); err != nil { log.Fatal(err) } } func ParseConfig(prim toml.Primitive) planr.InheritableConfig { config := GtestConfig{} primitiveDecode(prim, &config) return &config } func ParseDefaultConfig(prim toml.Primitive) planr.InheritableConfig { config := GtestDefaults{} primitiveDecode(prim, &config) return &config } /* BUILD PROCESS */ type GtestAdapter struct {} func (a GtestAdapter) Config() planr.AdapterConfig { return planr.AdapterConfig { Name: "gtest", ParseConfig: ParseConfig, ParseDefaultConfig: ParseDefaultConfig, } } func (a GtestAdapter) InitializeBuild() { fmt.Println("Initializing"); } func (a GtestAdapter) Build(tc planr.TestCase) { fmt.Printf("Building %v\n", tc); } func (a GtestAdapter) FinalizeBuild() { fmt.Println("Finalizing"); } func (a GtestAdapter) Evaluate(tc planr.TestCase) planr.TestResult { fmt.Printf("Evaluating %v\n", tc); return planr.TestResult {} } func (a GtestAdapter) Cleanup() { fmt.Printf("Cleaning\n") }