2018-08-02 10:02:13 +00:00
|
|
|
package rconfig
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2023-12-20 11:13:59 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2018-08-02 10:02:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestDeriveEnvVarName(t *testing.T) {
|
|
|
|
for test, expect := range map[string]string{
|
|
|
|
"1Foobar": "1_FOOBAR",
|
|
|
|
"BC1": "BC1",
|
|
|
|
"BIGCase1": "BIG_CASE1",
|
|
|
|
"BIGCase": "BIG_CASE",
|
|
|
|
"Camel1": "CAMEL1",
|
|
|
|
"camel": "CAMEL",
|
|
|
|
"Camel": "CAMEL",
|
|
|
|
"CAMEL": "CAMEL",
|
|
|
|
"CamelCase": "CAMEL_CASE",
|
|
|
|
"_foobar": "FOOBAR",
|
|
|
|
"ILoveGoAndJSONSoMuch": "I_LOVE_GO_AND_JSON_SO_MUCH",
|
2023-12-20 11:13:59 +00:00
|
|
|
"mrT": "MR_T",
|
|
|
|
"my_case1": "MY_CASE1",
|
|
|
|
"MyFieldName": "MY_FIELD_NAME",
|
|
|
|
"SmallCASE": "SMALL_CASE",
|
2018-08-02 10:02:13 +00:00
|
|
|
} {
|
2023-12-20 11:13:59 +00:00
|
|
|
assert.Equal(t, expect, deriveEnvVarName(test))
|
2018-08-02 10:02:13 +00:00
|
|
|
}
|
|
|
|
}
|