mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-26 10:23:28 +08:00
31 lines
751 B
Go
31 lines
751 B
Go
//go:build !cgo
|
|
|
|
package parser
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestOfficeParsers_ParseWithResult_NoCGO(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
res ParseResult
|
|
}{
|
|
{name: "docx", res: (&DOCXParser{}).ParseWithResult("a.docx", nil)},
|
|
{name: "doc", res: (&DOCParser{}).ParseWithResult("a.doc", nil)},
|
|
{name: "pptx", res: (&PPTXParser{}).ParseWithResult("a.pptx", nil)},
|
|
{name: "ppt", res: (&PPTParser{}).ParseWithResult("a.ppt", nil)},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if tc.res.Err == nil {
|
|
t.Fatal("want ErrOfficeCGORequired, got nil")
|
|
}
|
|
if !errors.Is(tc.res.Err, ErrOfficeCGORequired) {
|
|
t.Fatalf("err = %v, want wraps ErrOfficeCGORequired", tc.res.Err)
|
|
}
|
|
})
|
|
}
|
|
}
|