(t *testing.T)
| 392 | } |
| 393 | |
| 394 | func TestParsePayloadPositions(t *testing.T) { |
| 395 | positions, template := parsePayloadPositions("http://example.com/§100§/user/§200§", "§") |
| 396 | if len(positions) != 2 { |
| 397 | t.Fatalf("expected 2 positions, got %d: %v", len(positions), positions) |
| 398 | } |
| 399 | if positions[0] != "100" || positions[1] != "200" { |
| 400 | t.Errorf("unexpected positions: %v", positions) |
| 401 | } |
| 402 | // Template should contain internal placeholders for both positions |
| 403 | if !strings.Contains(template, payloadPlaceholderPrefix) { |
| 404 | t.Errorf("template should contain placeholder prefix, got: %q", template) |
| 405 | } |
| 406 | // Reconstruct original URL from template + positions |
| 407 | reconstructed := template |
| 408 | for i, val := range positions { |
| 409 | reconstructed = strings.Replace(reconstructed, payloadPlaceholder(i), val, 1) |
| 410 | } |
| 411 | if reconstructed != "http://example.com/100/user/200" { |
| 412 | t.Errorf("reconstructed URL mismatch: %q", reconstructed) |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | func TestParsePayloadPositions_NoMarkers(t *testing.T) { |
| 417 | positions, _ := parsePayloadPositions("http://example.com/admin", "§") |
nothing calls this directly
no test coverage detected