Files
beads/cmd/bd/scripttest_test.go
Steve Yegge a86f3e139e Add native Windows support (#91)
- Native Windows daemon using TCP loopback endpoints
- Direct-mode fallback for CLI/daemon compatibility
- Comment operations over RPC
- PowerShell installer script
- Go 1.24 requirement
- Cross-OS testing documented

Co-authored-by: danshapiro <danshapiro@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-c6230265-055f-4af1-9712-4481061886db
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 21:08:49 -07:00

33 lines
656 B
Go

package main
import (
"context"
"os/exec"
"path/filepath"
"runtime"
"testing"
"time"
"rsc.io/script"
"rsc.io/script/scripttest"
)
func TestScripts(t *testing.T) {
// Build the bd binary
exeName := "bd"
if runtime.GOOS == "windows" {
exeName += ".exe"
}
exe := filepath.Join(t.TempDir(), exeName)
if err := exec.Command("go", "build", "-o", exe, ".").Run(); err != nil {
t.Fatal(err)
}
// Create minimal engine with default commands plus bd
engine := script.NewEngine()
engine.Cmds["bd"] = script.Program(exe, nil, 100*time.Millisecond)
// Run all tests
scripttest.Test(t, context.Background(), engine, nil, "testdata/*.txt")
}