Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(688)

Unified Diff: src/pkg/runtime/string_test.go

Issue 110930043: code review 110930043: runtime: fix spurious "[string too long]" error (Closed)
Patch Set: diff -r 5b3092ce6741 https://dvyukov%40google.com@code.google.com/p/go/ Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pkg/runtime/stubs.goc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/runtime/string_test.go
===================================================================
--- a/src/pkg/runtime/string_test.go
+++ b/src/pkg/runtime/string_test.go
@@ -6,6 +6,7 @@
import (
"runtime"
+ "strings"
"testing"
)
@@ -122,3 +123,25 @@
}
}
}
+
+func TestLargeStringConcat(t *testing.T) {
+ output := executeTest(t, largeStringConcatSource, nil)
+ want := "panic: " + strings.Repeat("0", 1<<10) + strings.Repeat("1", 1<<10) +
+ strings.Repeat("2", 1<<10) + strings.Repeat("3", 1<<10)
+ if !strings.HasPrefix(output, want) {
+ t.Fatalf("output does not start with %q:\n%s", want, output)
+ }
+}
+
+var largeStringConcatSource = `
+package main
+import "strings"
+func main() {
+ s0 := strings.Repeat("0", 1<<10)
+ s1 := strings.Repeat("1", 1<<10)
+ s2 := strings.Repeat("2", 1<<10)
+ s3 := strings.Repeat("3", 1<<10)
+ s := s0 + s1 + s2 + s3
+ panic(s)
+}
+`
« no previous file with comments | « no previous file | src/pkg/runtime/stubs.goc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b