mirror of
https://github.com/encounter/go-rtmp.git
synced 2026-03-30 11:12:49 -07:00
32 lines
610 B
Go
32 lines
610 B
Go
//
|
|
// Copyright (c) 2018- yutopp (yutopp@gmail.com)
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
|
|
//
|
|
|
|
package message
|
|
|
|
import (
|
|
"bytes"
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestEncodeCommon(t *testing.T) {
|
|
for _, tc := range testCases {
|
|
tc := tc // capture
|
|
|
|
t.Run(tc.Name, func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
buf := new(bytes.Buffer)
|
|
|
|
enc := NewEncoder(buf)
|
|
err := enc.Encode(tc.Value)
|
|
assert.Nil(t, err)
|
|
assert.Equal(t, tc.Binary, buf.Bytes())
|
|
})
|
|
}
|
|
}
|