Files
Agent-Native/exec/backend_test.go
T
weichen 6ddd3da8df Enable canonical versioned Go module consumption
Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements.

Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate.

Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable.

Refs: Versioned dependencies U1/U3; feature/dependency-workspace
2026-10-13 15:36:10 +00:00

41 lines
826 B
Go

package exec_test
import (
"context"
"os"
"path/filepath"
"testing"
"time"
"git-ssh.u1680832.nyat.app/weichen/Agent-Native.git/exec"
)
func TestStubBackendExecution(t *testing.T) {
tmpDir := t.TempDir()
backend := &exec.StubBackend{}
if backend.Name() != "stub" {
t.Errorf("expected stub backend, got %s", backend.Name())
}
req := exec.Request{
WorkDir: tmpDir,
Prompt: "请编写用户初始需求收集表",
Targets: []string{"output.md"},
Timeout: 5 * time.Second,
}
res, err := backend.Execute(context.Background(), req)
if err != nil {
t.Fatalf("stub execute failed: %v", err)
}
if !res.Success {
t.Fatalf("expected success")
}
outputPath := filepath.Join(tmpDir, "output.md")
if _, err := os.Stat(outputPath); err != nil {
t.Fatalf("expected output.md to exist: %v", err)
}
}