aboutsummaryrefslogtreecommitdiffstats
path: root/util_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'util_test.go')
-rw-r--r--util_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/util_test.go b/util_test.go
new file mode 100644
index 0000000..7a87bde
--- /dev/null
+++ b/util_test.go
@@ -0,0 +1,32 @@
+package main
+
+import "testing"
+
+var yesShort = []string{
+ "asdf",
+ "as12df",
+ "as_df",
+}
+
+var noShort = []string{
+ "(!&#$(&@!#",
+ "_asdf",
+ "as df",
+ "ASDF",
+ "AS_DF",
+ "2o45",
+ "as.12df",
+}
+
+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)
+ }
+ }
+}