Files
beads/cmd/bd/scripttest_test.go
Steve Yegge d240439868 fix: Resolve Windows test failures and lint warnings
- Fix Windows binary path issues (bd.exe vs bd)
- Skip scripttest on Windows (requires Unix shell)
- Skip file lock tests on Windows (platform locking differences)
- Fix registry tests to use USERPROFILE on Windows
- Fix 8 unparam lint warnings by marking unused params with _

All changes are platform-aware and maintain functionality.

Amp-Thread-ID: https://ampcode.com/threads/T-bc27021a-65db-4b64-a3f3-4e8d7bc8aa0d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-02 08:30:31 -08:00

36 lines
800 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) {
// Skip on Windows - test scripts use sh -c which requires Unix shell
if runtime.GOOS == "windows" {
t.Skip("scripttest uses Unix shell commands (sh -c), skipping on Windows")
}
// Build the bd binary
exeName := "bd"
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
timeout := 2 * time.Second
engine := script.NewEngine()
engine.Cmds["bd"] = script.Program(exe, nil, timeout)
// Run all tests
scripttest.Test(t, context.Background(), engine, nil, "testdata/*.txt")
}