string([]int) is now implemented

R=rsc
DELTA=18  (10 added, 2 deleted, 6 changed)
OCL=29909
CL=29909
This commit is contained in:
Rob Pike 2009-06-04 16:51:47 -07:00
parent 2f2577a4f6
commit 6739b8d606
2 changed files with 16 additions and 8 deletions

View 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>

View 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 int array */
var z2 [3]int;
z2[0] = 'a';
z2[1] = '\u1234';
z2[2] = 'c';
c = string(&z2);
if c != "a\u1234c" {
panic("create int array ", c);
}
/* create string with byte array pointer */
z2 := new([3]byte);
z2[0] = 'a';
z2[1] = 'b';
z2[2] = 'c';
c = string(z2);
z3 := new([3]byte);
z3[0] = 'a';
z3[1] = 'b';
z3[2] = 'c';
c = string(z3);
if c != "abc" {
panic("create array pointer ", c);
}