[
https://issues.apache.org/jira/browse/PROTON-1432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16261544#comment-16261544
]
Jiri Daněk commented on PROTON-1432:
------------------------------------
There is one small problem with the feature, that I can see. The following test
fails
{code}
func TestFmtingOfAmqpChar(t *testing.T) {
r := rune(0x16b5)
ar := amqp.Char(r)
for _, ea := range [][]string {
{fmt.Sprintf("%c", r), fmt.Sprintf("%c", ar)},
{fmt.Sprintf("%x", r), fmt.Sprintf("%x", ar)}} {
if ea[0] != ea[1] {
t.Errorf("Expected `%s`, actual `%s`.", ea[0],
ea[1])
}
}
}
{code}
{noformat}
--- FAIL: TestAmqpChar (0.00s)
shim_test.go:136: Expected `16b5`, actual `e19ab5`.
FAIL
FAIL command-line-arguments 0.011s
{noformat}
This is caused by the {{String}} implementation in
{code}
func (c Char) String() string {
return fmt.Sprintf("%c", c)
}
{code}
Formatting amqp.Char as %x does not format the rune, but the utf-8 encoded
string containing the rune. The results of these two are different.
To fix this test, either removing the String method (not sure if that would
break something else) or implementing custom
https://golang.org/pkg/fmt/#Formatter should work.
> [go] Support marshaling and unmarshaling to/from the char AMQP type in
> message body
> -----------------------------------------------------------------------------------
>
> Key: PROTON-1432
> URL: https://issues.apache.org/jira/browse/PROTON-1432
> Project: Qpid Proton
> Issue Type: New Feature
> Components: go-binding
> Affects Versions: proton-c-0.18.0
> Reporter: Jiri Daněk
> Assignee: Alan Conway
> Priority: Minor
> Fix For: proton-c-0.19.0
>
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]