Fixed some tests.

This commit is contained in:
Storm Dragon committed 2026-10-14 01:22:04 -04:00
1 parent 6613237233
commit b2f558c26c
4 files changed
+32 -2

No files matched your search

+14
View File
@@ -3,6 +3,8 @@ package app
import (
"context"
"log/slog"
"os"
"os/exec"
"path/filepath"
"testing"
"time"
@@ -14,6 +16,18 @@ import (
)
func TestDateTimeFormats(t *testing.T) {
// datetime initializes libc's locale before tests run. Use a child process
// so these fixed English expectations do not depend on the build locale.
if os.Getenv("CTHULHU_DATE_TIME_TEST_CHILD") != "1" {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
command := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestDateTimeFormats$", "-test.count=1")
command.Env = append(os.Environ(), "LC_ALL=C", "CTHULHU_DATE_TIME_TEST_CHILD=1")
if output, err := command.CombinedOutput(); err != nil {
t.Fatalf("C-locale date/time test: %v\n%s", err, output)
}
return
}
now := time.Date(2026, 9, 17, 19, 5, 0, 0, time.UTC)
for _, tc := range []struct {
command input.Command
+11 -1
View File
@@ -79,7 +79,17 @@ func interactiveFixture(t *testing.T, mode string) (*tentacleRuntime, *internalU
if err := runtime.Start(ctx); err != nil {
t.Fatal(err)
}
waitTentacle(t, func() bool { return len(bindings.TentacleBindings()) != 0 })
waitTentacle(t, func() bool {
published := bindings.TentacleBindings()
if len(published) == 0 {
return false
}
// Native bindings are installed before activation publishes dispatch.
runtime.mutex.Lock()
defer runtime.mutex.Unlock()
_, ready := runtime.commands[published[0].Command]
return ready
})
runtime.Invoke(ctx, bindings.TentacleBindings()[0].Command)
return runtime, ui, keys, marker
}