mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-04 21:02:25 +08:00
* * 公众号菜单管理,set相关函数,返回btn本身,方便以字面量的方式创建多个菜单,更直观,方便管理 * * golangci-lint fix * * 获取二维码ticket接口没有往上抛接口错误 * * 增加GetOpenID方法,以获取消息的生产用户openID * * 支持公众号账号迁移,获取openID变化接口 * * bugfix * * golint fix * * golint fix
19 lines
701 B
Go
19 lines
701 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSliceChunk(t *testing.T) {
|
|
src1 := []string{"1", "2", "3", "4", "5"}
|
|
assert.Equal(t, [][]string{{"1", "2"}, {"3", "4"}, {"5"}}, SliceChunk(src1, 2))
|
|
assert.Equal(t, [][]string{{"1", "2", "3", "4", "5"}}, SliceChunk(src1, 5))
|
|
assert.Equal(t, [][]string{{"1", "2", "3", "4", "5"}}, SliceChunk(src1, 6))
|
|
assert.Equal(t, [][]string{{"1"}, {"2"}, {"3"}, {"4"}, {"5"}}, SliceChunk(src1, 1))
|
|
assert.Equal(t, [][]string{{"1"}, {"2"}, {"3"}, {"4"}, {"5"}}, SliceChunk(src1, 0))
|
|
assert.Equal(t, [][]string{{"1"}, {"2"}, {"3"}, {"4"}, {"5"}}, SliceChunk(src1, -100))
|
|
assert.Equal(t, [][]string{}, SliceChunk(nil, 5))
|
|
}
|