Commit 0332d46d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3b04f1df
...@@ -78,7 +78,6 @@ func Append(b []byte, x Stringer) []byte { ...@@ -78,7 +78,6 @@ func Append(b []byte, x Stringer) []byte {
} }
// V, similarly to %v, adds x formatted by default rules // V, similarly to %v, adds x formatted by default rules
// XXX -> V(interface {}) ?
func (b *Buffer) V(x Stringer) *Buffer { func (b *Buffer) V(x Stringer) *Buffer {
*b = Append(*b, x) *b = Append(*b, x)
return b return b
...@@ -96,13 +95,35 @@ func (b *Buffer) Sb(x []byte) *Buffer { ...@@ -96,13 +95,35 @@ func (b *Buffer) Sb(x []byte) *Buffer {
return b return b
} }
// Q appends string formatted by %q
func (b *Buffer) Q(s string) *Buffer {
*b = strconv.AppendQuote(*b, s)
return b
}
// Qb appends []byte formatted by %q
func (b *Buffer) Qb(s []byte) *Buffer {
*b = strconv.AppendQuote(*b, mem.String(s))
return b
}
// Qcb appends byte formatted by %q
func (b *Buffer) Qcb(c byte) *Buffer {
return b.Qc(rune(c))
}
// Qc appends rune formatted by %q
func (b *Buffer) Qc(c rune) *Buffer {
*b = strconv.AppendQuoteRune(*b, c)
return b
}
// Cb appends byte formatted by %c // Cb appends byte formatted by %c
func (b *Buffer) Cb(c byte) *Buffer { func (b *Buffer) Cb(c byte) *Buffer {
*b = append(*b, c) *b = append(*b, c)
return b return b
} }
// AppendRune appends to b UTF-8 encoding of r // AppendRune appends to b UTF-8 encoding of r
func AppendRune(b []byte, r rune) []byte { func AppendRune(b []byte, r rune) []byte {
l := len(b) l := len(b)
...@@ -175,26 +196,3 @@ func (b *Buffer) X016(x uint64) *Buffer { ...@@ -175,26 +196,3 @@ func (b *Buffer) X016(x uint64) *Buffer {
*b = AppendHex016(*b, x) *b = AppendHex016(*b, x)
return b return b
} }
// Q appends string formatted by %q
func (b *Buffer) Q(s string) *Buffer {
*b = strconv.AppendQuote(*b, s)
return b
}
// Qb appends []byte formatted by %q
func (b *Buffer) Qb(s []byte) *Buffer {
*b = strconv.AppendQuote(*b, mem.String(s))
return b
}
// Qcb appends byte formatted by %q
func (b *Buffer) Qcb(c byte) *Buffer {
return b.Qc(rune(c))
}
// Qc appends rune formatted by %q
func (b *Buffer) Qc(c rune) *Buffer {
*b = strconv.AppendQuoteRune(*b, c)
return b
}
...@@ -82,7 +82,6 @@ func TestXFmt(t *testing.T) { ...@@ -82,7 +82,6 @@ func TestXFmt(t *testing.T) {
} }
xargv := []reflect.Value{reflect.ValueOf(tt.value)} xargv := []reflect.Value{reflect.ValueOf(tt.value)}
xretv := []reflect.Value{} xretv := []reflect.Value{}
callOk := false callOk := false
func () { func () {
......
...@@ -48,7 +48,7 @@ var pyQuoteTestv = []struct {in, quoted string} { ...@@ -48,7 +48,7 @@ var pyQuoteTestv = []struct {in, quoted string} {
// utf-8 // utf-8
// XXX python escapes non-ascii, but since FileStorage connot // XXX python escapes non-ascii, but since FileStorage connot
// commit such strings we take the freedom and output them as // commit such strings we take the freedom and output them as
// readable // readable.
//{`привет мир`, `'\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82 \xd0\xbc\xd0\xb8\xd1\x80'`}, //{`привет мир`, `'\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82 \xd0\xbc\xd0\xb8\xd1\x80'`},
{`привет мир`, `'привет мир'`}, {`привет мир`, `'привет мир'`},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment