Files
beads/cmd/bd/scripttest_test.go
Travis Cline b17fcdbb2a Add scripttest-based integration tests (#59)
- Complete test coverage for all major bd commands:
  blocked, close, create, dep (add/remove/tree), export, help,
  import, init, list, quickstart, ready, show, stats, update, version
- Test data files validate command behavior and output
- Enables automated testing of full CLI workflows
2025-10-16 17:11:54 -07:00

26 lines
539 B
Go

package main
import (
"context"
"os/exec"
"testing"
"time"
"rsc.io/script"
"rsc.io/script/scripttest"
)
func TestScripts(t *testing.T) {
// Build the bd binary
exe := t.TempDir() + "/bd"
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")
}