From 6739b8d606e7439a5a2d5c29dd9e67451131e8b6 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Thu, 4 Jun 2009 16:51:47 -0700 Subject: [PATCH] string([]int) is now implemented R=rsc DELTA=18 (10 added, 2 deleted, 6 changed) OCL=29909 CL=29909 --- doc/go_spec.html | 2 -- test/ken/string.go | 22 ++++++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 793dbb2eab..ab05fbcd1b 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.
len() does not work on chans. -
-string([]int{...}) conversion is not yet implemented.

diff --git a/test/ken/string.go b/test/ken/string.go index a823e92835..f7c02822f1 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 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); }