@@ -20,7 +20,7 @@ func TestMain(m *testing.M) {
2020 }
2121
2222 var err error
23- g , err = NewGPTScript (GlobalOptions {})
23+ g , err = NewGPTScript (GlobalOptions {OpenAIAPIKey : os . Getenv ( "OPENAI_API_KEY" ) })
2424 if err != nil {
2525 panic (fmt .Sprintf ("error creating gptscript: %s" , err ))
2626 }
@@ -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\n README .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