aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2014-09-11 16:53:34 -0700
committerKeith Randall <khr@golang.org>2014-09-11 16:53:34 -0700
commitbcd36e8857729f6f3306ab22c26e582f1d2f2932 (patch)
treec11e1290f55082500ce5e09ddc819a87f320a912 /src/runtime/string_test.go
parent6e55f7a87b8400073119612c0a3bd3f443b69f14 (diff)
downloadgo-bcd36e8857729f6f3306ab22c26e582f1d2f2932.tar.xz
runtime: make gostringnocopy update maxstring
Fixes #8706 LGTM=josharian R=josharian CC=golang-codereviews https://golang.org/cl/143880043
Diffstat (limited to 'src/runtime/string_test.go')
-rw-r--r--src/runtime/string_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/runtime/string_test.go b/src/runtime/string_test.go
index e7ac51a5f0..1551ecc82b 100644
--- a/src/runtime/string_test.go
+++ b/src/runtime/string_test.go
@@ -145,3 +145,16 @@ func main() {
panic(s)
}
`
+
+func TestGostringnocopy(t *testing.T) {
+ max := *runtime.Maxstring
+ b := make([]byte, max+10)
+ for i := uintptr(0); i < max+9; i++ {
+ b[i] = 'a'
+ }
+ _ = runtime.Gostringnocopy(&b[0])
+ newmax := *runtime.Maxstring
+ if newmax != max+9 {
+ t.Errorf("want %d, got %d", max+9, newmax)
+ }
+}