aboutsummaryrefslogtreecommitdiff
path: root/adapters/gtest/config.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-22 23:27:53 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-22 23:27:53 -0500
commit24548e87decbdfea38bbf692cecad6d4eefc3ec0 (patch)
tree4f5d1432d1e22a1f19ceabbc92dcdd86bed98017 /adapters/gtest/config.go
parent5d33040ab80b5cce7883b2e5965aa17db2e6515a (diff)
downloadplanr-24548e87decbdfea38bbf692cecad6d4eefc3ec0.tar.xz
planr-24548e87decbdfea38bbf692cecad6d4eefc3ec0.zip
Refactoring & Enhanced logging
Diffstat (limited to 'adapters/gtest/config.go')
-rw-r--r--adapters/gtest/config.go50
1 files changed, 24 insertions, 26 deletions
diff --git a/adapters/gtest/config.go b/adapters/gtest/config.go
index 6a6c8bf..cb5ba75 100644
--- a/adapters/gtest/config.go
+++ b/adapters/gtest/config.go
@@ -8,23 +8,23 @@ import (
)
type GtestDefaults struct {
- Name *string
- Suite *string
- Testfile *string
- Test_root *string
- Srcs *[]string
- Srcs_root *string
+ Name *string
+ Suite *string
+ Testfile *string
+ Test_root *string
+ Srcs *[]string
+ Srcs_root *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.Testfile == nil) { child.Testfile = parent.Testfile }
- if(child.Test_root == nil) { child.Test_root = parent.Test_root }
- if(child.Srcs == nil) { child.Srcs = parent.Srcs }
- if(child.Srcs_root == nil) { child.Srcs_root = parent.Srcs_root }
+ if(child.Name == nil) { child.Name = parent.Name }
+ if(child.Suite == nil) { child.Suite = parent.Suite }
+ if(child.Testfile == nil) { child.Testfile = parent.Testfile }
+ if(child.Test_root == nil) { child.Test_root = parent.Test_root }
+ if(child.Srcs == nil) { child.Srcs = parent.Srcs }
+ if(child.Srcs_root == nil) { child.Srcs_root = parent.Srcs_root }
}
@@ -73,24 +73,22 @@ func (cfg GtestConfig) srcList() string {
return srcList
}
-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 {
+func ParseConfig(prim toml.Primitive) (planr.InheritableConfig, error) {
config := GtestConfig{}
-
- primitiveDecode(prim, &config)
-
- return &config
+
+ if err := toml.PrimitiveDecode(prim, &config); err != nil {
+ return nil, err
+ }
+
+ return &config, nil
}
-func ParseDefaultConfig(prim toml.Primitive) planr.InheritableConfig {
+func ParseDefaultConfig(prim toml.Primitive) (planr.InheritableConfig, error) {
config := GtestDefaults{}
- primitiveDecode(prim, &config)
+ if err := toml.PrimitiveDecode(prim, &config); err != nil {
+ return nil, err
+ }
- return &config
+ return &config, nil
}