@@ -20,7 +20,7 @@ func TestMain(m *testing.M) {
20
20
}
21
21
22
22
var err error
23
- g , err = NewGPTScript (GlobalOptions {})
23
+ g , err = NewGPTScript (GlobalOptions {OpenAIAPIKey : os . Getenv ( "OPENAI_API_KEY" ) })
24
24
if err != nil {
25
25
panic (fmt .Sprintf ("error creating gptscript: %s" , err ))
26
26
}
@@ -734,6 +734,20 @@ func TestConfirm(t *testing.T) {
734
734
for _ , o := range e .Call .Output {
735
735
eventContent += o .Content
736
736
}
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
+ }
737
751
}
738
752
}
739
753
@@ -742,7 +756,7 @@ func TestConfirm(t *testing.T) {
742
756
t .Errorf ("Error reading output: %v" , err )
743
757
}
744
758
745
- if ! strings .Contains (eventContent , "Makefile\n README .md" ) {
759
+ if ! strings .Contains (eventContent , "Makefile" ) || ! strings . Contains ( eventContent , "README .md" ) {
746
760
t .Errorf ("Unexpected event output: %s" , eventContent )
747
761
}
748
762
0 commit comments