feat: allow multiple added passwords

Fixes #584
This commit is contained in:
ZacharyZcR
2026-06-01 02:06:15 +08:00
parent bfc0e0fb52
commit ea17b5b1bc
9 changed files with 142 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
package common
import (
"reflect"
"testing"
)
func TestParsePasswordsSplitsCommaAndWhitespace(t *testing.T) {
fv := &FlagVars{
Password: "root,admin",
AddPasswords: "pass1 pass2,pass3\tpass4",
}
got := parsePasswords(fv)
want := []string{"root", "admin", "pass1", "pass2", "pass3", "pass4"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("parsePasswords() = %#v, want %#v", got, want)
}
}