platform_test.go 587 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package platform_test
  2. import (
  3. "testing"
  4. . "v2ray.com/core/common/platform"
  5. . "v2ray.com/ext/assert"
  6. )
  7. func TestNormalizeEnvName(t *testing.T) {
  8. assert := With(t)
  9. cases := []struct {
  10. input string
  11. output string
  12. }{
  13. {
  14. input: "a",
  15. output: "A",
  16. },
  17. {
  18. input: "a.a",
  19. output: "A_A",
  20. },
  21. {
  22. input: "A.A.B",
  23. output: "A_A_B",
  24. },
  25. }
  26. for _, test := range cases {
  27. assert(NormalizeEnvName(test.input), Equals, test.output)
  28. }
  29. }
  30. func TestEnvFlag(t *testing.T) {
  31. assert := With(t)
  32. assert(EnvFlag{
  33. Name: "xxxxx.y",
  34. }.GetValueAsInt(10), Equals, 10)
  35. }