(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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 | |
| 36 | func TestSplitPos(t *testing.T) { |
| 37 | tests := []struct { |
nothing calls this directly
no test coverage detected