feat: add workspace-isolated toolhost runtime and capability-gap skill loop
This commit is contained in:
32
internal/agent/react_parser_test.go
Normal file
32
internal/agent/react_parser_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package agent
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseDecisionPlainJSON(t *testing.T) {
|
||||
raw := `{"thought":"t","action":"none","action_input":"","final":"ok"}`
|
||||
got, err := parseDecision(raw)
|
||||
if err != nil {
|
||||
t.Fatalf("parseDecision error: %v", err)
|
||||
}
|
||||
if got.Action != "none" || got.Final != "ok" {
|
||||
t.Fatalf("unexpected decision: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseDecisionCodeFence(t *testing.T) {
|
||||
raw := "```json\n{\"thought\":\"t\",\"action\":\"shell\",\"action_input\":\"ls\",\"final\":\"\"}\n```"
|
||||
got, err := parseDecision(raw)
|
||||
if err != nil {
|
||||
t.Fatalf("parseDecision error: %v", err)
|
||||
}
|
||||
if got.Action != "shell" || got.ActionInput != "ls" {
|
||||
t.Fatalf("unexpected decision: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseDecisionInvalid(t *testing.T) {
|
||||
_, err := parseDecision("not json")
|
||||
if err == nil {
|
||||
t.Fatal("expected parse error")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user