49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestIsSeparator(t *testing.T) {
|
||
|
t.Run("rune A", func(t *testing.T) {
|
||
|
assert.Equal(t, false, isSeparator('A'))
|
||
|
})
|
||
|
t.Run("rune 9", func(t *testing.T) {
|
||
|
assert.Equal(t, false, isSeparator('9'))
|
||
|
})
|
||
|
t.Run("rune /", func(t *testing.T) {
|
||
|
assert.Equal(t, true, isSeparator('/'))
|
||
|
})
|
||
|
t.Run("rune \\", func(t *testing.T) {
|
||
|
assert.Equal(t, true, isSeparator('\\'))
|
||
|
})
|
||
|
t.Run("rune ♥ ", func(t *testing.T) {
|
||
|
assert.Equal(t, false, isSeparator('♥'))
|
||
|
})
|
||
|
t.Run("rune space", func(t *testing.T) {
|
||
|
assert.Equal(t, true, isSeparator(' '))
|
||
|
})
|
||
|
t.Run("rune '", func(t *testing.T) {
|
||
|
assert.Equal(t, false, isSeparator('\''))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestUcFirst(t *testing.T) {
|
||
|
t.Run("photo-lover", func(t *testing.T) {
|
||
|
assert.Equal(t, "Photo-lover", UcFirst("photo-lover"))
|
||
|
})
|
||
|
t.Run("cat", func(t *testing.T) {
|
||
|
assert.Equal(t, "Cat", UcFirst("Cat"))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func TestTitle(t *testing.T) {
|
||
|
t.Run("photo-lover", func(t *testing.T) {
|
||
|
assert.Equal(t, "Browse Your Life In Pictures", Title("Browse your life in pictures"))
|
||
|
})
|
||
|
t.Run("cat", func(t *testing.T) {
|
||
|
assert.Equal(t, "Photo-Lover", Title("photo-lover"))
|
||
|
})
|
||
|
}
|