// Created on savesnippets.com · https://savesnippets.com/6hCzNMtRF5HFvY package slugify_test import ( "testing" ) func TestSlugify(t *testing.T) { tests := []struct { name string input string want string }{ {"basic", "Hello, World!", "hello-world"}, {"accents", "Café au lait", "cafe-au-lait"}, {"already-slug", "already-slug", "already-slug"}, {"empty", "", ""}, {"only-symbols", "!!!@@@###", ""}, {"numbers", "Top 10 Apps", "top-10-apps"}, } for _, tc := range tests { tc := tc // capture range var (still good practice) t.Run(tc.name, func(t *testing.T) { t.Parallel() // run subtests concurrently if got := Slugify(tc.input); got != tc.want { t.Errorf("Slugify(%q) = %q, want %q", tc.input, got, tc.want) } }) } } // go test -run TestSlugify/accents