Merge pull request #653 from zzet/fix/issue-648-hxx
CI / test (1.26, macos-latest) (push) Waiting to run
CI / test (1.26, ubuntu-latest) (push) Waiting to run
CI / build-windows (push) Waiting to run
CI / build-linux-static (push) Waiting to run
CI / lint (push) Waiting to run
CI / build-onnx (push) Waiting to run
CI / benchmark (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
security / govulncheck (push) Waiting to run
security / trivy-fs (push) Waiting to run

This commit is contained in:
Andrew Kumanyaev
2026-08-22 15:21:36 +02:00
committed by GitHub
4 changed files with 9 additions and 1 deletions
+1
View File
@@ -66,6 +66,7 @@ var extractorSaltExtLang = map[string]string{
".cxx": "cpp",
".hpp": "cpp",
".hh": "cpp",
".hxx": "cpp",
".cs": "csharp",
// Razor templates are extracted by the C# extractor over their
// embedded code blocks, so a C# extraction fix has to re-flag them
@@ -70,12 +70,18 @@ func TestStaleLangsDetection(t *testing.T) {
if got := merkleSaltFor("src/Handler.php"); got != "php@2" {
t.Errorf("PHP extractor salt = %q, want php@2", got)
}
if got := merkleSaltFor("include/widget.hxx"); got != "cpp@2" {
t.Errorf("C++ extractor salt for .hxx = %q, want cpp@2", got)
}
})
t.Run("lang_for_file", func(t *testing.T) {
if got := ExtractorLangForFile("internal/auth/token.go"); got != "go" {
t.Errorf("ExtractorLangForFile(.go) = %q, want go", got)
}
if got := ExtractorLangForFile("include/widget.hxx"); got != "cpp" {
t.Errorf("ExtractorLangForFile(.hxx) = %q, want cpp", got)
}
if got := ExtractorLangForFile("README.zzz"); got != "" {
t.Errorf("ExtractorLangForFile(unknown) = %q, want \"\"", got)
}
+1 -1
View File
@@ -118,7 +118,7 @@ func NewCppExtractor() *CppExtractor {
}
func (e *CppExtractor) Language() string { return "cpp" }
func (e *CppExtractor) Extensions() []string { return []string{".cpp", ".cc", ".cxx", ".hpp"} }
func (e *CppExtractor) Extensions() []string { return []string{".cpp", ".cc", ".cxx", ".hpp", ".hxx"} }
// --- Deferred call buffer ----------------------------------------
+1
View File
@@ -136,6 +136,7 @@ func TestCppExtractor_Extensions(t *testing.T) {
assert.Contains(t, exts, ".cc")
assert.Contains(t, exts, ".cxx")
assert.Contains(t, exts, ".hpp")
assert.Contains(t, exts, ".hxx")
assert.NotContains(t, exts, ".h")
}