This commit is contained in:
36
e2e/go/code_test.go
generated
Normal file
36
e2e/go/code_test.go
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
// This file is auto-generated by alef — DO NOT EDIT.
|
||||
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||||
// To regenerate: alef generate
|
||||
// To verify freshness: alef verify --exit-code
|
||||
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||||
|
||||
// E2e tests for category: code
|
||||
package e2e_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
kreuzberg "github.com/kreuzberg-dev/kreuzberg/v5"
|
||||
)
|
||||
|
||||
func Test_CodeShebangDetection(t *testing.T) {
|
||||
// Test language detection from shebang line via bytes input
|
||||
mime_typeVal := `text/x-source-code`
|
||||
result, err := kreuzberg.ExtractFileSync(`code/script.sh`, &mime_typeVal, kreuzberg.ExtractionConfig{})
|
||||
if err != nil {
|
||||
t.Fatalf("call failed: %v", err)
|
||||
}
|
||||
if strings.TrimSpace(string(result.MimeType)) != `text/x-source-code` {
|
||||
t.Errorf("equals mismatch: got %v", result.MimeType)
|
||||
}
|
||||
assert.GreaterOrEqual(t, len(result.Content), 10, "expected length >= 10")
|
||||
if !strings.Contains(string(result.Content), `build`) {
|
||||
t.Errorf("expected to contain %s", `build`)
|
||||
}
|
||||
if !strings.Contains(string(result.Content), `clean`) {
|
||||
t.Errorf("expected to contain %s", `clean`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user