all repos — flounder @ cc103f75153a3c1a04b48bd6528ef2c22325cdeb

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}