-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabbrev_test.go
More file actions
40 lines (33 loc) · 753 Bytes
/
Copy pathabbrev_test.go
File metadata and controls
40 lines (33 loc) · 753 Bytes
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
36
37
38
39
40
package utils
import (
"testing"
)
func TestSimple(t *testing.T) {
assert := newAsserter(t)
words := []string{"hello", "help", "sync", "uint", "uint16", "uint64"}
ret := map[string]string{
"hello": "hello",
"hell": "hello",
"help": "help",
"sync": "sync",
"syn": "sync",
"sy": "sync",
"s": "sync",
"uint": "uint",
"uint16": "uint16",
"uint1": "uint16",
"uint64": "uint64",
"uint6": "uint64",
}
ab := Abbrev(words)
for k, v := range ab {
x, ok := ret[k]
assert(ok, "unexpected abbrev %s", k)
assert(x == v, "abbrev %s: exp %s, saw %s", k, x, v)
}
for k, v := range ret {
x, ok := ab[k]
assert(ok, "unknown abbrev %s", k)
assert(x == v, "abbrev %s: exp %s, saw %s", k, x, v)
}
}