From f6e2dc5439d63b611341a457190ffdd317520094 Mon Sep 17 00:00:00 2001 From: GGP1 Date: Wed, 3 Feb 2021 22:30:19 -0300 Subject: [PATCH] Typo fix --- password.go | 2 +- password_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/password.go b/password.go index 9567119..c9b13b0 100644 --- a/password.go +++ b/password.go @@ -211,7 +211,7 @@ repeat: func (p *Password) validateLevels() error { for _, lvl := range p.Levels { if len(lvl) < 1 { - continue + return errors.New("empty levels aren't allowed") } counter := 0 diff --git a/password_test.go b/password_test.go index 088d230..f07ab60 100644 --- a/password_test.go +++ b/password_test.go @@ -107,6 +107,7 @@ func TestInvalidPassword(t *testing.T) { cases := map[string]*Password{ "invalid length": {Length: 0}, "invalid levels": {Length: 10}, + "empty level": {Length: 3, Levels: []Level{Level("")}}, "not enough characters to meet the length required": { Length: 30, Levels: []Level{Lowercase},