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