]> Cypherpunks repositories - gostls13.git/commitdiff
string([]int) is now implemented
authorRob Pike <r@golang.org>
Thu, 4 Jun 2009 23:51:47 +0000 (16:51 -0700)
committerRob Pike <r@golang.org>
Thu, 4 Jun 2009 23:51:47 +0000 (16:51 -0700)
R=rsc
DELTA=18  (10 added, 2 deleted, 6 changed)
OCL=29909
CL=29909

doc/go_spec.html
test/ken/string.go

index 793dbb2eab3d38f518896851a5277d8e3109d649..ab05fbcd1bcaaf49bace69d66362cfc0952253de 100644 (file)
@@ -4388,8 +4388,6 @@ Implementation does not honor the restriction on goto statements and targets (no
 cap() does not work on maps or chans.
 <br/>
 len() does not work on chans.
-<br>
-string([]int{...}) conversion is not yet implemented.
 </font>
 </p>
 
index a823e92835675317e1ce97a576e98435a9bcd1df..f7c02822f1d751aed1f6bf7926453d8a25076a9c 100644 (file)
@@ -88,15 +88,25 @@ main()
        z1[2] = 'c';
        c = string(&z1);
        if c != "abc" {
-               panic("create array ", c);
+               panic("create byte array ", c);
        }
 
-       /* create string with byte array pointer */
-       z2 := new([3]byte);
+       /* create string with int array */
+       var z2 [3]int;
        z2[0] = 'a';
-       z2[1] = 'b';
+       z2[1] = '\u1234';
        z2[2] = 'c';
-       c = string(z2);
+       c = string(&z2);
+       if c != "a\u1234c" {
+               panic("create int array ", c);
+       }
+
+       /* create string with byte array pointer */
+       z3 := new([3]byte);
+       z3[0] = 'a';
+       z3[1] = 'b';
+       z3[2] = 'c';
+       c = string(z3);
        if c != "abc" {
                panic("create array pointer ", c);
        }