aboutsummaryrefslogtreecommitdiffstats
path: root/util_test.go
blob: 868a452bbf8bcfb72e2e148fdb74333dea8a0c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main

import "testing"

var yesShort = []string{
	"asdf",
	"as12df",
	"as_df",
}

var noShort = []string{
	"(!&#$(&@!#",
	"_asdf",
	"as   df",
	"ASDF",
	"AS_DF",
	"2o45",
	"as.12df",
	"5",
	"",
}

func TestIsShortName(t *testing.T) {
	for _, y := range yesShort {
		if !isShortName(y) {
			t.Errorf("Is short: " + y)
		}
	}
	for _, n := range noShort {
		if isShortName(n) {
			t.Errorf("Is not short: " + n)
		}
	}
}