• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang assert.NoError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/dataence/assert.NoError函数的典型用法代码示例。如果您正苦于以下问题:Golang NoError函数的具体用法?Golang NoError怎么用?Golang NoError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NoError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestPublishMessageFixedHeaderFields

func TestPublishMessageFixedHeaderFields(t *testing.T) {
	msg := NewPublishMessage()
	msg.flags = 11

	assert.True(t, true, msg.Dup(), "Incorrect DUP flag.")

	assert.True(t, true, msg.Retain(), "Incorrect RETAIN flag.")

	assert.Equal(t, true, 1, msg.QoS(), "Incorrect QoS.")

	msg.SetDup(false)
	assert.False(t, true, msg.Dup(), "Incorrect DUP flag.")

	msg.SetRetain(false)
	assert.False(t, true, msg.Retain(), "Incorrect RETAIN flag.")

	err := msg.SetQoS(2)
	assert.NoError(t, true, err, "Error setting QoS.")

	assert.Equal(t, true, 2, msg.QoS(), "Incorrect QoS.")

	err = msg.SetQoS(3)
	assert.Error(t, true, err)

	err = msg.SetQoS(0)
	assert.NoError(t, true, err, "Error setting QoS.")

	assert.Equal(t, true, 0, msg.QoS(), "Incorrect QoS.")

	msg.SetDup(true)
	assert.True(t, true, msg.Dup(), "Incorrect DUP flag.")

	msg.SetRetain(true)
	assert.True(t, true, msg.Retain(), "Incorrect RETAIN flag.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:35,代码来源:publish_test.go


示例2: TestPublishMessageEncode

func TestPublishMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(PUBLISH<<4) | 2,
		23,
		0, // topic name MSB (0)
		7, // topic name LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
		's', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e',
	}

	msg := NewPublishMessage()
	msg.SetTopic([]byte("surgemq"))
	msg.SetQoS(1)
	msg.SetPacketId(7)
	msg.SetPayload([]byte{'s', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e'})

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:25,代码来源:publish_test.go


示例3: TestSubackMessageEncode

func TestSubackMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(SUBACK << 4),
		6,
		0,    // packet ID MSB (0)
		7,    // packet ID LSB (7)
		0,    // return code 1
		1,    // return code 2
		2,    // return code 3
		0x80, // return code 4
	}

	msg := NewSubackMessage()
	msg.SetPacketId(7)
	msg.AddReturnCode(0)
	msg.AddReturnCode(1)
	msg.AddReturnCode(2)
	msg.AddReturnCode(0x80)

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:26,代码来源:suback_test.go


示例4: TestUnsubscribeMessageDecode

func TestUnsubscribeMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(UNSUBSCRIBE<<4) | 2,
		33,
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
		0, // topic name MSB (0)
		7, // topic name LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0, // topic name MSB (0)
		8, // topic name LSB (8)
		'/', 'a', '/', 'b', '/', '#', '/', 'c',
		0,  // topic name MSB (0)
		10, // topic name LSB (10)
		'/', 'a', '/', 'b', '/', '#', '/', 'c', 'd', 'd',
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewUnsubscribeMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, UNSUBSCRIBE, msg.Type(), "Error decoding message.")

	assert.Equal(t, true, 3, len(msg.Topics()), "Error decoding topics.")

	assert.True(t, true, msg.TopicExists([]byte("surgemq")), "Topic 'surgemq' should exist.")

	assert.True(t, true, msg.TopicExists([]byte("/a/b/#/c")), "Topic '/a/b/#/c' should exist.")

	assert.True(t, true, msg.TopicExists([]byte("/a/b/#/cdd")), "Topic '/a/b/#/c' should exist.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:35,代码来源:unsubscribe_test.go


示例5: TestSubscribeMessageEncode

func TestSubscribeMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(SUBSCRIBE<<4) | 2,
		36,
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
		0, // topic name MSB (0)
		7, // topic name LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0, // QoS
		0, // topic name MSB (0)
		8, // topic name LSB (8)
		'/', 'a', '/', 'b', '/', '#', '/', 'c',
		1,  // QoS
		0,  // topic name MSB (0)
		10, // topic name LSB (10)
		'/', 'a', '/', 'b', '/', '#', '/', 'c', 'd', 'd',
		2, // QoS
	}

	msg := NewSubscribeMessage()
	msg.SetPacketId(7)
	msg.AddTopic([]byte("surgemq"), 0)
	msg.AddTopic([]byte("/a/b/#/c"), 1)
	msg.AddTopic([]byte("/a/b/#/cdd"), 2)

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:33,代码来源:subscribe_test.go


示例6: TestPublishMessageDecode1

func TestPublishMessageDecode1(t *testing.T) {
	msgBytes := []byte{
		byte(PUBLISH<<4) | 2,
		23,
		0, // topic name MSB (0)
		7, // topic name LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
		's', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e',
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewPublishMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, 7, msg.PacketId(), "Error decoding message.")

	assert.Equal(t, true, "surgemq", string(msg.Topic()), "Error deocding topic name.")

	assert.Equal(t, true, []byte{'s', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e'}, msg.Payload(), "Error deocding payload.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:26,代码来源:publish_test.go


示例7: TestConnectMessageDecode

func TestConnectMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(CONNECT << 4),
		60,
		0, // Length MSB (0)
		4, // Length LSB (4)
		'M', 'Q', 'T', 'T',
		4,   // Protocol level 4
		206, // connect flags 11001110, will QoS = 01
		0,   // Keep Alive MSB (0)
		10,  // Keep Alive LSB (10)
		0,   // Client ID MSB (0)
		7,   // Client ID LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0, // Will Topic MSB (0)
		4, // Will Topic LSB (4)
		'w', 'i', 'l', 'l',
		0,  // Will Message MSB (0)
		12, // Will Message LSB (12)
		's', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e',
		0, // Username ID MSB (0)
		7, // Username ID LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0,  // Password ID MSB (0)
		10, // Password ID LSB (10)
		'v', 'e', 'r', 'y', 's', 'e', 'c', 'r', 'e', 't',
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewConnectMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, 206, msg.connectFlags, "Incorrect flag value.")

	assert.Equal(t, true, 10, msg.KeepAlive(), "Incorrect KeepAlive value.")

	assert.Equal(t, true, "surgemq", string(msg.ClientId()), "Incorrect client ID value.")

	assert.Equal(t, true, "will", string(msg.WillTopic()), "Incorrect will topic value.")

	assert.Equal(t, true, "send me home", string(msg.WillMessage()), "Incorrect will message value.")

	assert.Equal(t, true, "surgemq", string(msg.Username()), "Incorrect username value.")

	assert.Equal(t, true, "verysecret", string(msg.Password()), "Incorrect password value.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:50,代码来源:connect_test.go


示例8: TestDisconnectMessageEncode

func TestDisconnectMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(DISCONNECT << 4),
		0,
	}

	msg := NewDisconnectMessage()

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:15,代码来源:disconnect_test.go


示例9: TestPingrespMessageEncode

func TestPingrespMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(PINGRESP << 4),
		0,
	}

	msg := NewPingrespMessage()

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:15,代码来源:ping_test.go


示例10: TestDisconnectMessageDecode

func TestDisconnectMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(DISCONNECT << 4),
		0,
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewDisconnectMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, DISCONNECT, msg.Type(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:16,代码来源:disconnect_test.go


示例11: TestPublishMessageDecode3

// test qos = 0 and no client id
func TestPublishMessageDecode3(t *testing.T) {
	msgBytes := []byte{
		byte(PUBLISH << 4),
		21,
		0, // topic name MSB (0)
		7, // topic name LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		's', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e',
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewPublishMessage()

	_, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:17,代码来源:publish_test.go


示例12: TestPingrespMessageDecode

func TestPingrespMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(PINGRESP << 4),
		0,
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewPingrespMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, PINGRESP, msg.Type(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:16,代码来源:ping_test.go


示例13: TestConnectMessageEncode

func TestConnectMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(CONNECT << 4),
		60,
		0, // Length MSB (0)
		4, // Length LSB (4)
		'M', 'Q', 'T', 'T',
		4,   // Protocol level 4
		206, // connect flags 11001110, will QoS = 01
		0,   // Keep Alive MSB (0)
		10,  // Keep Alive LSB (10)
		0,   // Client ID MSB (0)
		7,   // Client ID LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0, // Will Topic MSB (0)
		4, // Will Topic LSB (4)
		'w', 'i', 'l', 'l',
		0,  // Will Message MSB (0)
		12, // Will Message LSB (12)
		's', 'e', 'n', 'd', ' ', 'm', 'e', ' ', 'h', 'o', 'm', 'e',
		0, // Username ID MSB (0)
		7, // Username ID LSB (7)
		's', 'u', 'r', 'g', 'e', 'm', 'q',
		0,  // Password ID MSB (0)
		10, // Password ID LSB (10)
		'v', 'e', 'r', 'y', 's', 'e', 'c', 'r', 'e', 't',
	}

	msg := NewConnectMessage()
	msg.SetWillQos(1)
	msg.SetVersion(4)
	msg.SetCleanSession(true)
	msg.SetClientId([]byte("surgemq"))
	msg.SetKeepAlive(10)
	msg.SetWillTopic([]byte("will"))
	msg.SetWillMessage([]byte("send me home"))
	msg.SetUsername([]byte("surgemq"))
	msg.SetPassword([]byte("verysecret"))

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:46,代码来源:connect_test.go


示例14: TestPubrelMessageEncode

func TestPubrelMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(PUBREL<<4) | 2,
		2,
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
	}

	msg := NewPubrelMessage()
	msg.SetPacketId(7)

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:18,代码来源:pubrel_test.go


示例15: TestConnackMessageEncode

func TestConnackMessageEncode(t *testing.T) {
	msgBytes := []byte{
		byte(CONNACK << 4),
		2,
		1, // session present
		0, // connection accepted
	}

	msg := NewConnackMessage()
	msg.SetReturnCode(ConnectionAccepted)
	msg.SetSessionPresent(true)

	dst, n, err := msg.Encode()
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error encoding message.")

	assert.Equal(t, true, msgBytes, dst.(*bytes.Buffer).Bytes(), "Error encoding connack message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:19,代码来源:connack_test.go


示例16: TestPubrelMessageDecode

func TestPubrelMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(PUBREL<<4) | 2,
		2,
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewPubrelMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, PUBREL, msg.Type(), "Error decoding message.")

	assert.Equal(t, true, 7, msg.PacketId(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:20,代码来源:pubrel_test.go


示例17: TestConnackMessageDecode

func TestConnackMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(CONNACK << 4),
		2,
		0, // session not present
		0, // connection accepted
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewConnackMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.False(t, true, msg.SessionPresent(), "Error decoding session present flag.")

	assert.Equal(t, true, ConnectionAccepted, msg.ReturnCode(), "Error decoding return code.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:20,代码来源:connack_test.go


示例18: TestUnsubackMessageDecode

func TestUnsubackMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(UNSUBACK << 4),
		2,
		0, // packet ID MSB (0)
		7, // packet ID LSB (7)
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewUnsubackMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, UNSUBACK, msg.Type(), "Error decoding message.")

	assert.Equal(t, true, 7, msg.PacketId(), "Error decoding message.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:20,代码来源:unsuback_test.go


示例19: TestSubackMessageDecode

func TestSubackMessageDecode(t *testing.T) {
	msgBytes := []byte{
		byte(SUBACK << 4),
		6,
		0,    // packet ID MSB (0)
		7,    // packet ID LSB (7)
		0,    // return code 1
		1,    // return code 2
		2,    // return code 3
		0x80, // return code 4
	}

	src := bytes.NewBuffer(msgBytes)
	msg := NewSubackMessage()

	n, err := msg.Decode(src)
	assert.NoError(t, true, err, "Error decoding message.")

	assert.Equal(t, true, len(msgBytes), n, "Error decoding message.")

	assert.Equal(t, true, SUBACK, msg.Type(), "Error decoding message.")

	assert.Equal(t, true, 4, len(msg.ReturnCodes()), "Error adding return code.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:24,代码来源:suback_test.go


示例20: TestConnectMessageFields

func TestConnectMessageFields(t *testing.T) {
	msg := NewConnectMessage()

	err := msg.SetVersion(0x3)
	assert.NoError(t, false, err, "Error setting message version.")

	assert.Equal(t, false, 0x3, msg.Version(), "Incorrect version number")

	err = msg.SetVersion(0x5)
	assert.Error(t, false, err)

	msg.SetCleanSession(true)
	assert.True(t, false, msg.CleanSession(), "Error setting clean session flag.")

	msg.SetCleanSession(false)
	assert.False(t, false, msg.CleanSession(), "Error setting clean session flag.")

	msg.SetWillFlag(true)
	assert.True(t, false, msg.WillFlag(), "Error setting will flag.")

	msg.SetWillFlag(false)
	assert.False(t, false, msg.WillFlag(), "Error setting will flag.")

	msg.SetWillRetain(true)
	assert.True(t, false, msg.WillRetain(), "Error setting will retain.")

	msg.SetWillRetain(false)
	assert.False(t, false, msg.WillRetain(), "Error setting will retain.")

	msg.SetPasswordFlag(true)
	assert.True(t, false, msg.PasswordFlag(), "Error setting password flag.")

	msg.SetPasswordFlag(false)
	assert.False(t, false, msg.PasswordFlag(), "Error setting password flag.")

	msg.SetUsernameFlag(true)
	assert.True(t, false, msg.UsernameFlag(), "Error setting username flag.")

	msg.SetUsernameFlag(false)
	assert.False(t, false, msg.UsernameFlag(), "Error setting username flag.")

	msg.SetWillQos(1)
	assert.Equal(t, false, 1, msg.WillQos(), "Error setting will QoS.")

	err = msg.SetWillQos(4)
	assert.Error(t, false, err)

	err = msg.SetClientId([]byte("j0j0jfajf02j0asdjf"))
	assert.NoError(t, false, err, "Error setting client ID")

	assert.Equal(t, false, "j0j0jfajf02j0asdjf", string(msg.ClientId()), "Error setting client ID.")

	err = msg.SetClientId([]byte("this is no good"))
	assert.Error(t, false, err)

	msg.SetWillTopic([]byte("willtopic"))
	assert.Equal(t, false, "willtopic", string(msg.WillTopic()), "Error setting will topic.")

	assert.True(t, false, msg.WillFlag(), "Error setting will flag.")

	msg.SetWillTopic([]byte(""))
	assert.Equal(t, false, "", string(msg.WillTopic()), "Error setting will topic.")

	assert.False(t, false, msg.WillFlag(), "Error setting will flag.")

	msg.SetWillMessage([]byte("this is a will message"))
	assert.Equal(t, false, "this is a will message", string(msg.WillMessage()), "Error setting will message.")

	assert.True(t, false, msg.WillFlag(), "Error setting will flag.")

	msg.SetWillMessage([]byte(""))
	assert.Equal(t, false, "", string(msg.WillMessage()), "Error setting will topic.")

	assert.False(t, false, msg.WillFlag(), "Error setting will flag.")

	msg.SetWillTopic([]byte("willtopic"))
	msg.SetWillMessage([]byte("this is a will message"))
	msg.SetWillTopic([]byte(""))
	assert.True(t, false, msg.WillFlag(), "Error setting will topic.")

	msg.SetUsername([]byte("myname"))
	assert.Equal(t, false, "myname", string(msg.Username()), "Error setting will message.")

	assert.True(t, false, msg.UsernameFlag(), "Error setting will flag.")

	msg.SetUsername([]byte(""))
	assert.Equal(t, false, "", string(msg.Username()), "Error setting will message.")

	assert.False(t, false, msg.UsernameFlag(), "Error setting will flag.")

	msg.SetPassword([]byte("myname"))
	assert.Equal(t, false, "myname", string(msg.Password()), "Error setting will message.")

	assert.True(t, false, msg.PasswordFlag(), "Error setting will flag.")

	msg.SetPassword([]byte(""))
	assert.Equal(t, false, "", string(msg.Password()), "Error setting will message.")

	assert.False(t, false, msg.PasswordFlag(), "Error setting will flag.")
}
开发者ID:charlesluo2014,项目名称:mqtt,代码行数:100,代码来源:connect_test.go



注:本文中的github.com/dataence/assert.NoError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang aws.String函数代码示例发布时间:2022-05-23
下一篇:
Golang assert.Equal函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap