fix(testgen): distinguish between C and C++ based on file extension
All checks were successful
CI / Test (pull_request) Successful in 55s
CI / Lint (pull_request) Successful in 33s
CI / Build (pull_request) Successful in 22s

Update language detection in testgen to set "C++" for files with .cpp, .cc, .cxx extensions, and "C" otherwise when the language is specified as "C/C++".
This commit is contained in:
Gregory Gauthier 2026-03-06 14:36:49 +00:00
parent 6f6596c13f
commit 13b6c88ba3

View File

@ -50,6 +50,15 @@ Examples:
continue continue
} }
lang := langObj.Name lang := langObj.Name
if lang == "C/C++" {
ext := strings.ToLower(filepath.Ext(filePath))
switch ext {
case ".cpp", ".cc", ".cxx":
lang = "C++"
default:
lang = "C"
}
}
if !supportedLangs[lang] { if !supportedLangs[lang] {
color.Yellow("Unsupported lang '%s' for %s (supported: Go/Python/C/C++)", lang, filePath) color.Yellow("Unsupported lang '%s' for %s (supported: Go/Python/C/C++)", lang, filePath)
allSuccess = false allSuccess = false