File: parse_int_test.go

package info (click to toggle)
golang-github-cheekybits-genny 1.0.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 336 kB
  • sloc: makefile: 17; sh: 3
file content (35 lines) | stat: -rw-r--r-- 668 bytes parent folder | download
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
35
package parse

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestIsAlphaNumeric(t *testing.T) {

	for _, r := range []rune{'a', '1', '_', 'A', 'Z'} {
		assert.True(t, isAlphaNumeric(r))
	}
	for _, r := range []rune{' ', '[', ']', '!', '"'} {
		assert.False(t, isAlphaNumeric(r))
	}

}

func TestWordify(t *testing.T) {

	for word, wordified := range map[string]string{
		"int":         "Int",
		"*int":        "Int",
		"string":      "String",
		"*MyType":     "MyType",
		"*myType":     "MyType",
		"interface{}": "Interface",
		"pack.type":   "Packtype",
		"*pack.type":  "Packtype",
	} {
		assert.Equal(t, wordified, wordify(word, true))
	}

}