From 3017cc5ba962bf922f187b0b03bec9011b4025ec Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 21 Mar 2020 15:52:07 +0100 Subject: [PATCH] add method tests for pattern collision --- internal/config/config_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index a857bdf..ca1569e 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -739,6 +739,36 @@ func TestServiceCollision(t *testing.T) { ]`, ErrPatternCollision, }, + { + `[ + { "method": "GET", "path": "/a/{b}", + "info": "info", "in": { + "{b}": { "info":"info", "type": "uint" } + } + }, + { "method": "GET", "path": "/a/{c}", + "info": "info", "in": { + "{c}": { "info":"info", "type": "uint" } + } + } + ]`, + ErrPatternCollision, + }, + { + `[ + { "method": "GET", "path": "/a/{b}", + "info": "info", "in": { + "{b}": { "info":"info", "type": "uint" } + } + }, + { "method": "PUT", "path": "/a/{c}", + "info": "info", "in": { + "{c}": { "info":"info", "type": "uint" } + } + } + ]`, + nil, // different methods + }, } for i, test := range tests {