Skip to content

packets1: Fix field name in WillTopicUpd.String #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packets1/willtopicupd.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (p *WillTopicUpd) Unpack(buf []byte) error {

func (p WillTopicUpd) String() string {
if len(p.WillTopic) == 0 {
return fmt.Sprintf(`WILLTOPICUPD(WillTopicUpd="")`)
return fmt.Sprintf(`WILLTOPICUPD(WillTopic="")`)
}
return fmt.Sprintf("WILLTOPICUPD(WillTopicUpd=%#v, QOS=%d, Retain=%t)", p.WillTopic, p.QOS, p.Retain)
return fmt.Sprintf("WILLTOPICUPD(WillTopic=%#v, QOS=%d, Retain=%t)", p.WillTopic, p.QOS, p.Retain)
}
4 changes: 2 additions & 2 deletions packets1/willtopicupd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func TestWillTopicUpdUnmarshalInvalid(t *testing.T) {

func TestWillTopicUpdStringer(t *testing.T) {
pkt := NewWillTopicUpd("test-topic", 1, true)
assert.Equal(t, `WILLTOPICUPD(WillTopicUpd="test-topic", QOS=1, Retain=true)`, pkt.String())
assert.Equal(t, `WILLTOPICUPD(WillTopic="test-topic", QOS=1, Retain=true)`, pkt.String())

// Packet with a zero-length topic.
pkt = NewWillTopicUpd("", 0, false)
assert.Equal(t, `WILLTOPICUPD(WillTopicUpd="")`, pkt.String())
assert.Equal(t, `WILLTOPICUPD(WillTopic="")`, pkt.String())
}