Skip to content

Commit

Permalink
rename to testEngineAllowDuplicateTags
Browse files Browse the repository at this point in the history
  • Loading branch information
sungjujin authored and kevinburkesegment committed Jul 18, 2024
1 parent d582855 commit f03f0bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestEngine(t *testing.T) {
},
{
scenario: "calling Engine.Incr produces expected tags when AllowDuplicateTags is set",
function: testEngineSkipTagDuplicateRemoval,
function: testEngineAllowDuplicateTags,
},
}

Expand Down Expand Up @@ -130,7 +130,7 @@ func testEngineFlush(t *testing.T, eng *stats.Engine) {
}
}

func testEngineSkipTagDuplicateRemoval(t *testing.T, eng *stats.Engine) {
func testEngineAllowDuplicateTags(t *testing.T, eng *stats.Engine) {
e2 := eng.WithTags()
e2.AllowDuplicateTags = true
if e2.Prefix != "test" {
Expand Down
7 changes: 3 additions & 4 deletions tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ func TagsAreSorted(tags []Tag) bool {
return slices.IsSortedFunc(tags, tagCompare)
}

// SortTags sorts and deduplicates tags in-place,
// favoring later elements whenever a tag name duplicate occurs.
// The returned slice may be shorter than the input
// due to the elimination of duplicates.
// SortTags sorts and deduplicates tags in-place, favoring later elements
// whenever a tag name duplicate occurs. The returned slice may be shorter than
// the input due to the elimination of duplicates.
func SortTags(tags []Tag) []Tag {
// Stable sort ensures that we have deterministic
// "latest wins" deduplication.
Expand Down

0 comments on commit f03f0bc

Please sign in to comment.