Skip to content

Commit 2e0191a

Browse files
committed
fix: adjust TestConfirm for Windows
Signed-off-by: Donnie Adams <[email protected]>
1 parent 39e4e76 commit 2e0191a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

gptscript_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,20 @@ func TestConfirm(t *testing.T) {
734734
for _, o := range e.Call.Output {
735735
eventContent += o.Content
736736
}
737+
738+
if e.Call.Type == EventTypeCallConfirm {
739+
// On Windows, ls may not be recognized as a command. The LLM will try to run the dir command. Confirm it.
740+
if !strings.Contains(e.Call.Input, "\"dir\"") {
741+
t.Errorf("unexpected confirm input: %s", e.Call.Input)
742+
}
743+
744+
if err = g.Confirm(context.Background(), AuthResponse{
745+
ID: e.Call.ID,
746+
Accept: true,
747+
}); err != nil {
748+
t.Errorf("Error confirming: %v", err)
749+
}
750+
}
737751
}
738752
}
739753

@@ -742,7 +756,7 @@ func TestConfirm(t *testing.T) {
742756
t.Errorf("Error reading output: %v", err)
743757
}
744758

745-
if !strings.Contains(eventContent, "Makefile\nREADME.md") {
759+
if !strings.Contains(eventContent, "Makefile") || !strings.Contains(eventContent, "README.md") {
746760
t.Errorf("Unexpected event output: %s", eventContent)
747761
}
748762

0 commit comments

Comments
 (0)