qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiri Daněk (JIRA) <j...@apache.org>
Subject [jira] [Commented] (PROTON-1432) [go] Support marshaling and unmarshaling to/from the char AMQP type in message body
Date Tue, 21 Nov 2017 21:50:00 GMT

    [ 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

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])

--- FAIL: TestAmqpChar (0.00s)
        shim_test.go:136: Expected `16b5`, actual `e19ab5`.
FAIL    command-line-arguments  0.011s

This is caused by the {{String}} implementation in

func (c Char) String() string {
       return fmt.Sprintf("%c", c)

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

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org

View raw message