feat: added some more test harness.

This commit is contained in:
James Wells 2023-04-03 19:43:35 -07:00
parent 7f9a5777bd
commit bdeaf2ec92
Signed by: jwells
GPG key ID: 73196D10B8E65666
8 changed files with 513 additions and 59 deletions

View file

@ -0,0 +1,31 @@
package main_test
import (
"io/ioutil"
"os"
"testing"
picol "github.com/dragonheim/gagent/pkg/picol/picol_unused"
)
func Test_RunPicol(t *testing.T) {
// Create a temporary test file
content := []byte("set a 5\nset b 7\n+ $a $b\n")
tmpfile, err := ioutil.TempFile("", "picol_test")
if err != nil {
t.Fatalf("Error creating temporary test file: %v", err)
}
defer os.Remove(tmpfile.Name()) // clean up
if _, err := tmpfile.Write(content); err != nil {
t.Fatalf("Error writing content to temporary test file: %v", err)
}
if err := tmpfile.Close(); err != nil {
t.Fatalf("Error closing temporary test file: %v", err)
}
err = picol.RunPicol(tmpfile.Name())
if err != nil {
t.Errorf("Error during RunPicol: %v", err)
}
}