MCPcopy
hub / github.com/labstack/echo / TestContext_SetParamNamesShouldNotModifyPathValuesCapacity

Function TestContext_SetParamNamesShouldNotModifyPathValuesCapacity

context_test.go:760–781  ·  view source on GitHub ↗

Issue #1655

(t *testing.T)

Source from the content-addressed store, hash-verified

758
759// Issue #1655
760func TestContext_SetParamNamesShouldNotModifyPathValuesCapacity(t *testing.T) {
761 e := New()
762 c := e.NewContext(nil, nil)
763
764 assert.Equal(t, int32(0), e.contextPathParamAllocSize.Load())
765 expectedTwoParams := PathValues{
766 {Name: "1", Value: "one"},
767 {Name: "2", Value: "two"},
768 }
769 c.SetPathValues(expectedTwoParams)
770 assert.Equal(t, int32(0), e.contextPathParamAllocSize.Load())
771 assert.Equal(t, expectedTwoParams, c.PathValues())
772
773 expectedThreeParams := PathValues{
774 {Name: "1", Value: "one"},
775 {Name: "2", Value: "two"},
776 {Name: "3", Value: "three"},
777 }
778 c.SetPathValues(expectedThreeParams)
779 assert.Equal(t, int32(0), e.contextPathParamAllocSize.Load())
780 assert.Equal(t, expectedThreeParams, c.PathValues())
781}
782
783func TestContextFormValue(t *testing.T) {
784 f := make(url.Values)

Callers

nothing calls this directly

Calls 4

SetPathValuesMethod · 0.95
PathValuesMethod · 0.95
NewFunction · 0.85
NewContextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…