// Used to crash because nByte didn't allow for a sign.
{"%b", int64(-1 << 63), "-1000000000000000000000000000000000000000000000000000000000000000"},
+
+ // Complex fmt used to leave the plus flag set for future entries in the array
+ // causing +2+0i and +3+0i instead of 2+0i and 3+0i.
+ {"%v", []complex64{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
+ {"%v", []complex128{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
}
func TestSprintf(t *testing.T) {
func (f *fmt) fmt_c64(v complex64, verb rune) {
f.buf.WriteByte('(')
r := real(v)
+ oldPlus := f.plus
for i := 0; ; i++ {
switch verb {
case 'e':
f.plus = true
r = imag(v)
}
+ f.plus = oldPlus
f.buf.Write(irparenBytes)
}
func (f *fmt) fmt_c128(v complex128, verb rune) {
f.buf.WriteByte('(')
r := real(v)
+ oldPlus := f.plus
for i := 0; ; i++ {
switch verb {
case 'e':
f.plus = true
r = imag(v)
}
+ f.plus = oldPlus
f.buf.Write(irparenBytes)
}