mirror of
https://github.com/dragonheim/gagent.git
synced 2025-05-24 04:16:47 -07:00
feat: added some more test harness.
This commit is contained in:
parent
7f9a5777bd
commit
bdeaf2ec92
8 changed files with 513 additions and 59 deletions
31
pkg/picol/picol_unused/main_test.go_unused
Normal file
31
pkg/picol/picol_unused/main_test.go_unused
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue