代码整理
This commit is contained in:
29
packets/codes_test.go
Normal file
29
packets/codes_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// SPDX-FileCopyrightText: 2022 mochi-mqtt, mochi-co
|
||||
// SPDX-FileContributor: mochi-co
|
||||
|
||||
package packets
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCodesString(t *testing.T) {
|
||||
c := Code{
|
||||
Reason: "test",
|
||||
Code: 0x1,
|
||||
}
|
||||
|
||||
require.Equal(t, "test", c.String())
|
||||
}
|
||||
|
||||
func TestCodesError(t *testing.T) {
|
||||
c := Code{
|
||||
Reason: "error",
|
||||
Code: 0x1,
|
||||
}
|
||||
|
||||
require.Equal(t, "error", error(c).Error())
|
||||
}
|
||||
Reference in New Issue
Block a user