mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
613 B
42 lines
613 B
8 years ago
|
package platform_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
. "v2ray.com/core/common/platform"
|
||
|
"v2ray.com/core/testing/assert"
|
||
|
)
|
||
|
|
||
|
func TestNormalizeEnvName(t *testing.T) {
|
||
|
assert := assert.On(t)
|
||
|
|
||
|
cases := []struct {
|
||
|
input string
|
||
|
output string
|
||
|
}{
|
||
|
{
|
||
|
input: "a",
|
||
|
output: "A",
|
||
|
},
|
||
|
{
|
||
|
input: "a.a",
|
||
|
output: "A_A",
|
||
|
},
|
||
|
{
|
||
|
input: "A.A.B",
|
||
|
output: "A_A_B",
|
||
|
},
|
||
|
}
|
||
|
for _, test := range cases {
|
||
|
assert.String(NormalizeEnvName(test.input)).Equals(test.output)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestEnvFlag(t *testing.T) {
|
||
|
assert := assert.On(t)
|
||
|
|
||
|
assert.Int(EnvFlag{
|
||
|
Name: "xxxxx.y",
|
||
|
}.GetValueAsInt(10)).Equals(10)
|
||
|
}
|