tracing_test.go 622 B

123456789101112131415161718192021222324252627282930313233343536
  1. package tracing
  2. import "testing"
  3. func TestGroupSplit(t *testing.T) {
  4. tests := []struct {
  5. input string
  6. expected map[string]string
  7. }{
  8. {
  9. input: "tag1:value1,tag2:value2",
  10. expected: map[string]string{
  11. "tag1": "value1",
  12. "tag2": "value2",
  13. },
  14. },
  15. {
  16. input: "",
  17. expected: map[string]string{},
  18. },
  19. {
  20. input: "tag1",
  21. expected: map[string]string{},
  22. },
  23. }
  24. for _, test := range tests {
  25. tags := splitTagSettings(test.input)
  26. for k, v := range test.expected {
  27. value, exists := tags[k]
  28. if !exists || value != v {
  29. t.Errorf("tags does not match %v ", test)
  30. }
  31. }
  32. }
  33. }