summaryrefslogtreecommitdiff
path: root/adapters/gtest/templating.go
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/gtest/templating.go')
-rw-r--r--adapters/gtest/templating.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/adapters/gtest/templating.go b/adapters/gtest/templating.go
index a9a3b07..57532fa 100644
--- a/adapters/gtest/templating.go
+++ b/adapters/gtest/templating.go
@@ -8,12 +8,12 @@ import (
)
type cmakeUnit struct {
- Cname string
+ ExeNm string
File string
Srcs string
};
-func genCmake(out string, units []cmakeUnit) {
+func generateCmakeScript(out string, units []cmakeUnit) {
file, err := os.OpenFile(out, os.O_RDWR | os.O_CREATE, 0644)
defer func () {
err := file.Close()
@@ -33,27 +33,29 @@ func genCmake(out string, units []cmakeUnit) {
for _, unit := range units {
if err := tmpl.Execute(file, unit); err != nil {
- log.Fatalf("Failed to generate unit %s: %v", unit.Cname, err);
+ log.Fatalf("Failed to generate unit %s: %v", unit.ExeNm, err);
}
}
}
+// TODO: Add comments
func unitTemplate() *template.Template {
tmpl, err := template.New("gtest_unit").Parse(`
+
add_executable(
- "{{.Cname}}"
+ "{{.ExeNm}}"
"{{.File}}"
{{.Srcs}}
)
target_link_libraries(
- "{{.Cname}}"
+ "{{.ExeNm}}"
gtest_main
)
gtest_discover_tests(
- "{{.Cname}}"
+ "{{.ExeNm}}"
)
`)