all repos — flounder @ 874f2c2176ec383701dcb731e2a1349d81f83795

A small site builder for the Gemini protocol

flounder_test.go (view raw)

 1package main
 2
 3import "testing"
 4
 5func TestIsOKUsername(t *testing.T) {
 6	for _, u := range []string{"www", "proxy", "%", "", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"} {
 7		if isOkUsername(u) == nil {
 8			t.Errorf("Username " + u + " should be considered invalid, but wasn't")
 9		}
10	}
11	for _, u := range []string{"-", "alex", "1"} {
12		if isOkUsername(u) != nil {
13			t.Errorf("Username " + u + " should be considered valid, but wasn't")
14		}
15	}
16}