Initial commit

This commit is contained in:
yan.y
2024-03-27 23:25:08 +08:00
commit 0884384e91
127 changed files with 9353 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package str
import "testing"
func TestJoin(t *testing.T) {
t.Run("字符串拼接", func(t *testing.T) {
if got := Join("abc", " ", "def"); got != "abc def" {
t.Errorf("Join() = %v, want %v", got, "abc def")
}
})
t.Run("字符串拼接单个字符", func(t *testing.T) {
if got := Join("abc"); got != "abc" {
t.Errorf("Join() = %v, want %v", got, "abc")
}
})
t.Run("中文字符串拼接", func(t *testing.T) {
if got := Join("中文字符串拼接", " ", "你好"); got != "中文字符串拼接 你好" {
t.Errorf("Join() = %v, want %v", got, "中文字符串拼接 你好")
}
})
t.Run("中文字符串拼接单个字符", func(t *testing.T) {
if got := Join("中文字符串拼接"); got != "中文字符串拼接" {
t.Errorf("Join() = %v, want %v", got, "中文字符串拼接")
}
})
}