mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-05 17:40:24 +08:00
31 lines
917 B
Go
31 lines
917 B
Go
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
|
|
|
package utils_test
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
|
"github.com/iwind/TeaGo/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestSplitStrings(t *testing.T) {
|
|
t.Log(utils.SplitStrings("a, b, c", ","))
|
|
t.Log(utils.SplitStrings("a, b, c, ", ","))
|
|
}
|
|
|
|
func TestContainsStringInsensitive(t *testing.T) {
|
|
var a = assert.NewAssertion(t)
|
|
a.IsTrue(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "A"))
|
|
a.IsTrue(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "b"))
|
|
a.IsTrue(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "c"))
|
|
a.IsFalse(utils.ContainsStringInsensitive([]string{"a", "b", "C"}, "d"))
|
|
}
|
|
|
|
func TestSimilar(t *testing.T) {
|
|
t.Log(utils.Similar("", ""))
|
|
t.Log(utils.Similar("", "a"))
|
|
t.Log(utils.Similar("abc", "bcd"))
|
|
t.Log(utils.Similar("efgj", "hijk"))
|
|
t.Log(utils.Similar("efgj", "klmn"))
|
|
}
|