diff options
author | Rob Pike <r@golang.org> | 2009-06-04 16:51:47 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2009-06-04 16:51:47 -0700 |
commit | 6ee0b38a258e8786ec720b339364082c159e50dd (patch) | |
tree | e169dd19fd0cbc490f86f6dadde064dc7a6cb421 | |
parent | 5ccfd20a190db8b9c777fdda4731c6debdb6bd36 (diff) | |
download | golang-6ee0b38a258e8786ec720b339364082c159e50dd.tar.gz |
string([]int) is now implemented
R=rsc
DELTA=18 (10 added, 2 deleted, 6 changed)
OCL=29909
CL=29909
-rw-r--r-- | doc/go_spec.html | 2 | ||||
-rw-r--r-- | test/ken/string.go | 20 |
2 files changed, 15 insertions, 7 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index 793dbb2ea..ab05fbcd1 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -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> diff --git a/test/ken/string.go b/test/ken/string.go index a823e9283..f7c02822f 100644 --- a/test/ken/string.go +++ b/test/ken/string.go @@ -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); } |