-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparser_test.go
More file actions
48 lines (35 loc) · 795 Bytes
/
parser_test.go
File metadata and controls
48 lines (35 loc) · 795 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
41
42
43
44
45
46
47
48
package fantasyname
import (
"errors"
"testing"
"github.com/s0rg/fantasyname/wrappers"
)
func TestParserErrors(t *testing.T) {
t.Parallel()
var e error
p := &parser{}
if e = p.OnGroupEnd(true); e == nil {
t.Error("group end: no error")
}
if !errors.Is(e, ErrEmptyStack) {
t.Error("group end: unexpected error")
}
if e = p.OnGroupSplit(); e == nil {
t.Error("group split: no error")
}
if !errors.Is(e, ErrEmptyStack) {
t.Error("group split: unexpected error")
}
if e = p.OnSymbol(' '); e == nil {
t.Error("symbol: no error")
}
if !errors.Is(e, ErrEmptyStack) {
t.Error("symbol: unexpected error")
}
if e = p.Wrap(wrappers.Collapsed); e == nil {
t.Error("wrap: no error")
}
if !errors.Is(e, ErrEmptyStack) {
t.Error("wrap: unexpected error")
}
}