package main import "testing" func TestDestinoSeguro(t *testing.T) { casos := map[string]string{ "/pedir/nueva?fecha=2026-10-09": "/pedir/nueva?fecha=2026-10-09", "/pedir/mis-fechas": "/pedir/mis-fechas", "": "", "/": "", "/index.html": "", "//evil.example/pedir/": "", "https://evil.example/pedir/": "", "/\\evil.example/pedir/": "", "/pedir/\r\nSet-Cookie: x=1": "", "javascript:alert(1)": "", } for entrada, quiero := range casos { if got := destinoSeguro(entrada); got != quiero { t.Errorf("destinoSeguro(%q) = %q, quiero %q", entrada, got, quiero) } } }