From a9b0085e40f6b9149ebe79868f68ce5c86fe6456 Mon Sep 17 00:00:00 2001 From: Agnes-George1 Date: Mon, 24 Nov 2025 18:10:08 +0530 Subject: [PATCH] formatted --- tree_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tree_test.go b/tree_test.go index f2e64bad..778605fc 100644 --- a/tree_test.go +++ b/tree_test.go @@ -521,16 +521,16 @@ func TestTreeChildConflict(t *testing.T) { func TestWildcardConflictWithStringsCut(t *testing.T) { // Test the strings.Cut usage in wildcard conflict detection (line 258 in tree.go) tree := &node{} - + // Add a route with a wildcard parameter tree.addRoute("/user/:name", fakeHandler("/user/:name")) - + // Try to add a conflicting route that will trigger the strings.Cut path // This should panic with a wildcard conflict recv := catchPanic(func() { tree.addRoute("/user/:id/profile", fakeHandler("/user/:id/profile")) }) - + if recv == nil { t.Error("Expected panic for wildcard conflict, but got none") } @@ -539,28 +539,28 @@ func TestWildcardConflictWithStringsCut(t *testing.T) { func TestCatchAllConflictWithStringsCut(t *testing.T) { // Test the strings.Cut usage in catch-all conflict detection (line 382 in tree.go) tree := &node{} - + // Add a route with a path segment tree.addRoute("/files/list", fakeHandler("/files/list")) - + // Try to add a catch-all route that conflicts // This should panic with a catch-all conflict recv := catchPanic(func() { tree.addRoute("/files/*filepath", fakeHandler("/files/*filepath")) }) - + if recv == nil { t.Error("Expected panic for catch-all conflict, but got none") } - + // Also test with an empty children case to cover line 382 when len(n.children) == 0 tree2 := &node{} tree2.addRoute("/docs/", fakeHandler("/docs/")) - + recv2 := catchPanic(func() { tree2.addRoute("/docs/*page", fakeHandler("/docs/*page")) }) - + if recv2 == nil { t.Error("Expected panic for catch-all conflict with empty children, but got none") }