Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
0332d46d
Commit
0332d46d
authored
Apr 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3b04f1df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
27 deletions
+24
-27
t/neo/xcommon/xfmt/fmt.go
t/neo/xcommon/xfmt/fmt.go
+23
-25
t/neo/xcommon/xfmt/fmt_test.go
t/neo/xcommon/xfmt/fmt_test.go
+0
-1
t/neo/xcommon/xfmt/python_test.go
t/neo/xcommon/xfmt/python_test.go
+1
-1
No files found.
t/neo/xcommon/xfmt/fmt.go
View file @
0332d46d
...
...
@@ -78,7 +78,6 @@ func Append(b []byte, x Stringer) []byte {
}
// V, similarly to %v, adds x formatted by default rules
// XXX -> V(interface {}) ?
func
(
b
*
Buffer
)
V
(
x
Stringer
)
*
Buffer
{
*
b
=
Append
(
*
b
,
x
)
return
b
...
...
@@ -96,13 +95,35 @@ func (b *Buffer) Sb(x []byte) *Buffer {
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
func
(
b
*
Buffer
)
Cb
(
c
byte
)
*
Buffer
{
*
b
=
append
(
*
b
,
c
)
return
b
}
// AppendRune appends to b UTF-8 encoding of r
func
AppendRune
(
b
[]
byte
,
r
rune
)
[]
byte
{
l
:=
len
(
b
)
...
...
@@ -175,26 +196,3 @@ func (b *Buffer) X016(x uint64) *Buffer {
*
b
=
AppendHex016
(
*
b
,
x
)
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
}
t/neo/xcommon/xfmt/fmt_test.go
View file @
0332d46d
...
...
@@ -82,7 +82,6 @@ func TestXFmt(t *testing.T) {
}
xargv
:=
[]
reflect
.
Value
{
reflect
.
ValueOf
(
tt
.
value
)}
xretv
:=
[]
reflect
.
Value
{}
callOk
:=
false
func
()
{
...
...
t/neo/xcommon/xfmt/python_test.go
View file @
0332d46d
...
...
@@ -48,7 +48,7 @@ var pyQuoteTestv = []struct {in, quoted string} {
// utf-8
// XXX python escapes non-ascii, but since FileStorage connot
// 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'`},
{
`привет мир`
,
`'привет мир'`
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment