aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index 4f6ef9a3f2..95e2cbb959 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -2079,3 +2079,21 @@ func DumpPrintQuoted(s string) string {
return string(buf)
}
+
+// DumpPrint returns the output of print(v).
+func DumpPrint[T any](v T) string {
+ gp := getg()
+ gp.writebuf = make([]byte, 0, 2048)
+ print(v)
+ buf := gp.writebuf
+ gp.writebuf = nil
+
+ return string(buf)
+}
+
+var (
+ Float64Bytes = float64Bytes
+ Float32Bytes = float32Bytes
+ Complex128Bytes = complex128Bytes
+ Complex64Bytes = complex64Bytes
+)