MCPcopy
hub / github.com/gorilla/mux / testTemplate

Function testTemplate

mux_test.go:1889–1909  ·  view source on GitHub ↗
(t *testing.T, test routeTest)

Source from the content-addressed store, hash-verified

1887}
1888
1889func testTemplate(t *testing.T, test routeTest) {
1890 route := test.route
1891 pathTemplate := test.pathTemplate
1892 if len(pathTemplate) == 0 {
1893 pathTemplate = test.path
1894 }
1895 hostTemplate := test.hostTemplate
1896 if len(hostTemplate) == 0 {
1897 hostTemplate = test.host
1898 }
1899
1900 routePathTemplate, pathErr := route.GetPathTemplate()
1901 if pathErr == nil && routePathTemplate != pathTemplate {
1902 t.Errorf("(%v) GetPathTemplate not equal: expected %v, got %v", test.title, pathTemplate, routePathTemplate)
1903 }
1904
1905 routeHostTemplate, hostErr := route.GetHostTemplate()
1906 if hostErr == nil && routeHostTemplate != hostTemplate {
1907 t.Errorf("(%v) GetHostTemplate not equal: expected %v, got %v", test.title, hostTemplate, routeHostTemplate)
1908 }
1909}
1910
1911func testMethods(t *testing.T, test routeTest) {
1912 route := test.route

Callers 13

TestHostFunction · 0.85
TestPathFunction · 0.85
TestPathPrefixFunction · 0.85
TestSchemeHostPathFunction · 0.85
TestHeadersFunction · 0.85
TestMethodsFunction · 0.85
TestQueriesFunction · 0.85
TestSchemesFunction · 0.85
TestMatcherFuncFunction · 0.85
TestBuildVarsFuncFunction · 0.85
TestSubRouterFunction · 0.85
TestStrictSlashFunction · 0.85

Calls 2

GetPathTemplateMethod · 0.80
GetHostTemplateMethod · 0.80

Tested by

no test coverage detected