Add runtime abstraction and agent loop
Co-authored-by: codegirl007 <codegirl-007@users.noreply.github.com>
This commit is contained in:
co-authored by
codegirl007
parent
54dc5658c6
commit
94146fcae2
@@ -0,0 +1,28 @@
|
||||
package appspec
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestResolveDirectoryManifest(t *testing.T) {
|
||||
directory := t.TempDir()
|
||||
executable := filepath.Join(directory, "game")
|
||||
if err := os.WriteFile(executable, []byte("binary"), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
manifest := `{"command":"game","args":["--demo"],"window_title":"Demo"}`
|
||||
if err := os.WriteFile(filepath.Join(directory, "agentbox.json"), []byte(manifest), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
command, err := Resolve(directory)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if command.Path != executable || command.WindowTitle != "Demo" ||
|
||||
len(command.Args) != 1 || command.Args[0] != "--demo" {
|
||||
t.Fatalf("command = %#v", command)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user