-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmangle_test.go
31 lines (26 loc) · 873 Bytes
/
mangle_test.go
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
package main
import "testing"
import "github.com/stretchr/testify/assert"
func TestMangleCtor(t *testing.T) {
testcases := [][4]string{
[4]string{"newValOf", "Val", "Int", "newIntOf"},
[4]string{"make", "Val", "Int", "makeInt"},
[4]string{"Make", "Val", "int", "MakeInt"},
[4]string{"ValOfTea", "val", "Int", "IntOfTea"},
}
for _, tc := range testcases {
assert.Equal(t, tc[3], MangleCtorName(tc[0], tc[1], tc[2]))
}
}
func TestMangleDepType(t *testing.T) {
testcases := [][4]string{
[4]string{"valEntry", "Val", "Int", "intEntry"},
[4]string{"entry", "val", "int", "intEntry"},
[4]string{"ValEntry", "Val", "zzz", "ZzzEntry"},
[4]string{"EntryValName", "Val", "zzz", "EntryZzzName"},
[4]string{"entryValName", "Val", "X", "entryXName"},
}
for _, tc := range testcases {
assert.Equal(t, tc[3], MangleDepTypeName(tc[0], tc[1], tc[2]))
}
}