fix(testgen): distinguish between C and C++ based on file extension
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:
parent
6f6596c13f
commit
13b6c88ba3
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user