aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/string_test.go')
-rw-r--r--src/runtime/string_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/string_test.go b/src/runtime/string_test.go
index 03c8948467..249f431e18 100644
--- a/src/runtime/string_test.go
+++ b/src/runtime/string_test.go
@@ -175,3 +175,14 @@ func TestCompareTempString(t *testing.T) {
t.Fatalf("want 0 allocs, got %v", n)
}
}
+
+func TestStringOnStack(t *testing.T) {
+ s := ""
+ for i := 0; i < 3; i++ {
+ s = "a" + s + "b" + s + "c"
+ }
+
+ if want := "aaabcbabccbaabcbabccc"; s != want {
+ t.Fatalf("want: '%v', got '%v'", want, s)
+ }
+}