3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Test string operations including printing.
20 /* print a variable */
23 /* catenate literals */
24 print(`abc`+`xyz`, "-")
26 /* catenate variables */
29 /* compare literals */
30 if `abc` == `xyz` || `abc` != "abc" || `abc` > `xyz` {
31 panic("compare literals")
34 /* compare variables */
35 if a == b || a != a || a > b {
36 panic("compare variables")
48 /* clumsy evaluation */
60 for i := 0; i < len(c); i = i + 1 {
61 if c[i] != (a + b)[i] {
62 print("index ", i, " ", c[i], " ", (a + b)[i])
72 /* create string with integer constant */
75 panic("create int " + c)
78 /* create string with integer variable */
82 panic("create int " + c)
85 /* create string with byte array */
92 panic("create byte array " + c)
95 /* create string with int array */
102 panic("create int array " + c)
105 /* create string with byte array pointer */
112 panic("create array pointer " + c)