diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-05 00:37:23 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-05 00:37:23 -0500 |
commit | 151d516e68f5d43aa2d0c5ff462752d640b6a614 (patch) | |
tree | 6d12582bb6fdea41434ad02be89cc18824c5b80b /adapters/gtest/templating.go | |
parent | cc7ba659adbc5ad55e1ce67f76952f2b8392c9c9 (diff) | |
download | deb-planr-151d516e68f5d43aa2d0c5ff462752d640b6a614.tar.xz deb-planr-151d516e68f5d43aa2d0c5ff462752d640b6a614.zip |
Refactor gtest adapter to fit new pipeline
Diffstat (limited to 'adapters/gtest/templating.go')
-rw-r--r-- | adapters/gtest/templating.go | 14 |
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}}" ) `) |