From 28825aae534ec134536511abb4f99289d8fcbcb8 Mon Sep 17 00:00:00 2001 From: Chrstopher Hunter <8398225+crhntr@users.noreply.github.com> Date: Sun, 18 Aug 2024 22:24:07 -0700 Subject: [PATCH] add tests for pattern sorting --- pattern_internal_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pattern_internal_test.go b/pattern_internal_test.go index 190ca0c..f5a72c8 100644 --- a/pattern_internal_test.go +++ b/pattern_internal_test.go @@ -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)