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