aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/go.go-torture/execute/string-2.go
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/go.go-torture/execute/string-2.go')
-rw-r--r--gcc-4.9/gcc/testsuite/go.go-torture/execute/string-2.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/go.go-torture/execute/string-2.go b/gcc-4.9/gcc/testsuite/go.go-torture/execute/string-2.go
new file mode 100644
index 000000000..72b0f2334
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/go.go-torture/execute/string-2.go
@@ -0,0 +1,16 @@
+package main
+
+func fn(s string) string {
+ if len(s) != 3 {
+ panic(0)
+ }
+ i := len(s) - 1;
+ return s + s[0 : i];
+}
+
+func main() {
+ s := fn("abc");
+ if s != "abcab" {
+ panic(1)
+ }
+}