(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestGenerateRandomString(t *testing.T) { |
| 10 | forbiddenCharsRegex := regexp.MustCompile("[^a-zA-Z0-9]") |
| 11 | for i := 0; i < 1000; i++ { |
| 12 | randString := GenerateRandomString(1) |
| 13 | if len(randString) != 1 { |
| 14 | t.Error("Random String has unexpected length.\nExpected: 1\nActual: " + strconv.Itoa(len(randString))) |
| 15 | t.Fail() |
| 16 | } |
| 17 | |
| 18 | if forbiddenCharsRegex.Match([]byte(randString)) { |
| 19 | t.Error("Bad Character in generated String. Expected only letters and numbers. Acutal: " + randString) |
| 20 | t.Fail() |
| 21 | } |
| 22 | } |
| 23 | } |
nothing calls this directly
no test coverage detected