mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
Add test for containsCapitals function
This commit is contained in:
parent
ac37354986
commit
d5f13f7a91
1 changed files with 43 additions and 0 deletions
43
session/session_setup_test.go
Normal file
43
session/session_setup_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package session
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_containsCapitals(t *testing.T) {
|
||||
type args struct {
|
||||
s string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "Test all alpha lowercase",
|
||||
args: args{s: "abcdefghijklmnopqrstuvwxyz"},
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "Test all alpha uppercase",
|
||||
args: args{s: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Test special chars",
|
||||
args: args{s: "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
|
||||
want: false,
|
||||
},
|
||||
// Add test for UTF8 ?
|
||||
// {
|
||||
// name: "Test special UTF-8 chars",
|
||||
// args: args{s: "€©¶αϚϴЈ"},
|
||||
// want: false,
|
||||
// },
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := containsCapitals(tt.args.s); got != tt.want {
|
||||
t.Errorf("containsCapitals() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue