diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-05 20:13:19 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-05 20:13:19 +0900 |
| commit | 9fd97e71d0330d6b6509f28686cf53825bc80941 (patch) | |
| tree | 35774cbde4c1abd9967a1de98341a732ff3b464f /container/stub | |
| parent | fba201c9953a490da914b09e09eaaa697a4b36e1 (diff) | |
treewide: fit test untyped int literals in 32-bit
This enables hakurei test suite to run on 32-bit targets.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/stub')
| -rw-r--r-- | container/stub/errors.go | 2 | ||||
| -rw-r--r-- | container/stub/exit.go | 4 | ||||
| -rw-r--r-- | container/stub/exit_test.go | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/container/stub/errors.go b/container/stub/errors.go index 4d13a67f..d97b6256 100644 --- a/container/stub/errors.go +++ b/container/stub/errors.go @@ -13,7 +13,7 @@ var ( type UniqueError uintptr func (e UniqueError) Error() string { - return "unique error " + strconv.Itoa(int(e)) + " injected by the test suite" + return "unique error " + strconv.FormatUint(uint64(e), 10) + " injected by the test suite" } func (e UniqueError) Is(target error) bool { diff --git a/container/stub/exit.go b/container/stub/exit.go index 6470fe6e..062ee2e0 100644 --- a/container/stub/exit.go +++ b/container/stub/exit.go @@ -3,10 +3,10 @@ package stub import "testing" // PanicExit is a magic panic value treated as a simulated exit. -const PanicExit = 0xdeadbeef +const PanicExit = 0xdead const ( - panicFailNow = 0xcafe0000 + iota + panicFailNow = 0xcafe0 + iota panicFatal panicFatalf ) diff --git a/container/stub/exit_test.go b/container/stub/exit_test.go index 15ad31f1..5d850759 100644 --- a/container/stub/exit_test.go +++ b/container/stub/exit_test.go @@ -53,7 +53,7 @@ func TestHandleExit(t *testing.T) { } }() defer stub.HandleExit(ot) - panic(0xcafe0000) + panic(0xcafe0) }) t.Run("Fail", func(t *testing.T) { @@ -66,7 +66,7 @@ func TestHandleExit(t *testing.T) { } }() defer handleExitNew(ot) - panic(0xcafe0000) + panic(0xcafe0) }) }) @@ -82,14 +82,14 @@ func TestHandleExit(t *testing.T) { t.Parallel() defer func() { - want := 0xcafebabe + want := 0xcafe if r := recover(); r != want { t.Errorf("recover: %v, want %v", r, want) } }() defer stub.HandleExit(t) - panic(0xcafebabe) + panic(0xcafe) }) t.Run("new", func(t *testing.T) { |
