github.com/blend/go-sdk@v1.20220411.3/statsd/tag_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package statsd
     9  
    10  import (
    11  	"testing"
    12  
    13  	"github.com/blend/go-sdk/assert"
    14  )
    15  
    16  func Test_Tag(t *testing.T) {
    17  	assert := assert.New(t)
    18  
    19  	testCases := []struct {
    20  		Key      string
    21  		Value    string
    22  		Expected string
    23  	}{
    24  		{Key: "foo", Value: "bar", Expected: "foo:bar"},
    25  		{Key: "foo1", Value: "bar:", Expected: "foo1:bar:"},
    26  		{Key: "foo_", Value: "bar_", Expected: "foo_:bar_"},
    27  		{Key: "foo%", Value: "bar$", Expected: "foo_:bar_"},
    28  		{Key: "foo;", Value: "bar#", Expected: "foo_:bar_"},
    29  		{Key: "foo;", Value: "bar#", Expected: "foo_:bar_"},
    30  	}
    31  
    32  	for _, tc := range testCases {
    33  		assert.Equal(tc.Expected, Tag(tc.Key, tc.Value))
    34  	}
    35  }