Skip to content

Commit

Permalink
add tests for pattern sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
crhntr committed Aug 19, 2024
1 parent a69daef commit 28825aa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pattern_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ func TestTemplateName_ByPathThenMethod(t *testing.T) {
"GET / F3()",
),
},
{
// this is blocked higher up in parsing templates but this is lower down so if a
// caller does not use TemplatePatterns they get consistent results
Name: "method and path are the same",
In: mustNewTemplateName(
"GET / F2()",
"GET / F3()",
"GET / F1()",
),
Exp: mustNewTemplateName(
"GET / F1()",
"GET / F2()",
"GET / F3()",
),
},
} {
t.Run(tt.Name, func(t *testing.T) {
slices.SortFunc(tt.In, Pattern.byPathThenMethod)
Expand Down

0 comments on commit 28825aa

Please sign in to comment.