mirror of https://github.com/databricks/cli.git
55 lines
824 B
Go
55 lines
824 B
Go
|
package textutil
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestNormalizeString(t *testing.T) {
|
||
|
cases := []struct {
|
||
|
input string
|
||
|
expected string
|
||
|
}{
|
||
|
{
|
||
|
input: "test",
|
||
|
expected: "test",
|
||
|
},
|
||
|
{
|
||
|
input: "test test",
|
||
|
expected: "test_test",
|
||
|
},
|
||
|
{
|
||
|
input: "test-test",
|
||
|
expected: "test_test",
|
||
|
},
|
||
|
{
|
||
|
input: "test_test",
|
||
|
expected: "test_test",
|
||
|
},
|
||
|
{
|
||
|
input: "test.test",
|
||
|
expected: "test_test",
|
||
|
},
|
||
|
{
|
||
|
input: "test/test",
|
||
|
expected: "test_test",
|
||
|
},
|
||
|
{
|
||
|
input: "test/test.test",
|
||
|
expected: "test_test_test",
|
||
|
},
|
||
|
{
|
||
|
input: "TestTest",
|
||
|
expected: "testtest",
|
||
|
},
|
||
|
{
|
||
|
input: "TestTestTest",
|
||
|
expected: "testtesttest",
|
||
|
}}
|
||
|
|
||
|
for _, c := range cases {
|
||
|
assert.Equal(t, c.expected, NormalizeString(c.input))
|
||
|
}
|
||
|
}
|