MCPcopy Create free account
hub / github.com/php/frankenphp / TestEnsureLeadingSlash

Function TestEnsureLeadingSlash

cgi_test.go:10–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestEnsureLeadingSlash(t *testing.T) {
11 t.Parallel()
12
13 tests := []struct {
14 input string
15 expected string
16 }{
17 {"/index.php", "/index.php"},
18 {"index.php", "/index.php"},
19 {"/", "/"},
20 {"", ""},
21 {"/path/to/script.php", "/path/to/script.php"},
22 {"path/to/script.php", "/path/to/script.php"},
23 {"/index.php/path/info", "/index.php/path/info"},
24 {"index.php/path/info", "/index.php/path/info"},
25 }
26
27 for _, tt := range tests {
28 t.Run(tt.input+"-"+tt.expected, func(t *testing.T) {
29 t.Parallel()
30
31 assert.Equal(t, tt.expected, ensureLeadingSlash(tt.input), "ensureLeadingSlash(%q)", tt.input)
32 })
33 }
34}
35
36func TestSplitPos(t *testing.T) {
37 tests := []struct {

Callers

nothing calls this directly

Calls 1

ensureLeadingSlashFunction · 0.85

Tested by

no test coverage detected