diff options
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index f71494174c..bc471e50a0 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -2084,6 +2084,24 @@ 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 +) + func GetScanAlloc() uintptr { c := getMCache(getg().m) return c.scanAlloc |
