mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-03 04:47:29 +08:00
refactor: stabilize runtime and unify config
This commit is contained in:
22
pkg/tools/camera_test.go
Normal file
22
pkg/tools/camera_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCameraToolParsesFilenameArg(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tool := NewCameraTool(t.TempDir())
|
||||
_, err := tool.Execute(context.Background(), map[string]interface{}{
|
||||
"filename": "custom.jpg",
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatal("expected camera access to fail in test environment")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "/dev/video0") && !strings.Contains(err.Error(), "camera device") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user