package templates import ( "testing" ) func TestSafeDisplayNameToPathSegment(t *testing.T) { tests := []struct { input string expected string }{ {"Разработка серверной", "Разработка серверной"}, {"Проект/Подпроект", "Проект_Подпроект"}, {"File:Name*Test?\"Test", "File Name Test Test"}, {"../../evil", "_._.._evil"}, {".hidden", "_hidden"}, {" spaced ", "spaced"}, {"", "Без названия"}, {"AB", "AB"}, } for _, tt := range tests { t.Run(tt.input, func(t *testing.T) { got := SafeDisplayNameToPathSegment(tt.input) if got != tt.expected { t.Errorf("SafeDisplayNameToPathSegment(%q) = %q, want %q", tt.input, got, tt.expected) } }) } } func TestSafeDisplayNameToPathSegment_Long(t *testing.T) { long := "" for i := 0; i < 300; i++ { long += "a" } got := SafeDisplayNameToPathSegment(long) if len(got) > 200 { t.Errorf("expected max 200 chars, got %d", len(got)) } }