test(stringx): test Getrange

This commit is contained in:
bandl 2021-10-20 21:42:58 +08:00
parent fe096c9054
commit 5b0a636e02
1 changed files with 10 additions and 1 deletions

View File

@ -1,9 +1,10 @@
package stringx
import (
"testing"
"gitee.com/timedb/wheatCache/pkg/structure"
"github.com/stretchr/testify/require"
"testing"
)
func TestStringSingle_Set(t *testing.T) {
@ -80,3 +81,11 @@ func TestStringSingle_Getbit(t *testing.T) {
require.NoError(t, err)
require.Equal(t, res, false)
}
func TestStringSingle_Getrange(t *testing.T) {
s := NewStringSingle()
s.Set("abcdefg")
k, err := s.Getrange(0, 3)
require.NoError(t, err)
require.Equal(t, "abc", k)
}