aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sandbox/assert_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-12 23:03:22 +0900
committerOphestra <cat@gensokyo.uk>2025-11-12 23:03:22 +0900
commitb5630f6883c874d458d9ae3c666cfb7ae5e3121d (patch)
treee2c488165211b1f68b9eaef8469d92a81ba37f43 /test/sandbox/assert_test.go
parent17ffdb2dcf3bb5c8edf277a017cecd8e71a2e26b (diff)
test: move package sandbox internal
This should never be used outside vm tests. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/sandbox/assert_test.go')
-rw-r--r--test/sandbox/assert_test.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/test/sandbox/assert_test.go b/test/sandbox/assert_test.go
deleted file mode 100644
index efeb7cb3..00000000
--- a/test/sandbox/assert_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-//go:build testtool
-
-package sandbox
-
-import (
- "encoding/json"
- "os"
- "path"
- "testing"
-)
-
-type F func(format string, v ...any)
-
-func SwapPrint(f F) (old F) { old = printfFunc; printfFunc = f; return }
-func SwapFatal(f F) (old F) { old = fatalfFunc; fatalfFunc = f; return }
-
-func MustWantFile(t *testing.T, v any) (wantFile string) {
- wantFile = path.Join(t.TempDir(), "want.json")
- if f, err := os.OpenFile(wantFile, os.O_CREATE|os.O_WRONLY, 0400); err != nil {
- t.Fatalf("cannot create %q: %v", wantFile, err)
- } else if err = json.NewEncoder(f).Encode(v); err != nil {
- t.Fatalf("cannot encode to %q: %v", wantFile, err)
- } else if err = f.Close(); err != nil {
- t.Fatalf("cannot close %q: %v", wantFile, err)
- }
-
- t.Cleanup(func() {
- if err := os.Remove(wantFile); err != nil {
- t.Fatalf("cannot remove %q: %v", wantFile, err)
- }
- })
-
- return
-}