More windows tests

This commit is contained in:
Viktor Liu
2025-07-03 13:56:32 +02:00
parent f1bb4d2ac3
commit aa30b7afe8
4 changed files with 17 additions and 13 deletions

View File

@@ -574,11 +574,15 @@ func TestUsernameValidation(t *testing.T) {
{"username_with_newline", "user\nname", true, "invalid characters"},
{"reserved_dot", ".", true, "cannot be '.' or '..'"},
{"reserved_dotdot", "..", true, "cannot be '.' or '..'"},
{"username_with_at_symbol", "user@domain", true, "invalid characters"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Skip hyphen test on Windows - Windows allows usernames starting with hyphens
if tt.name == "username_starting_with_hyphen" && runtime.GOOS == "windows" {
t.Skip("Windows allows usernames starting with hyphens")
}
err := validateUsername(tt.username)
if tt.wantErr {
assert.Error(t, err, "Should reject invalid username")