blob: 698fb7bcbbfcae6e5d02c3367fee648080d7ac0e (
plain)
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 nguh
import (
"testing"
"github.com/eaburns/peggy/peg"
)
func TestCompile(t *testing.T) {
inp := &peg.Node{Text: "h"}
_, err := Compile(inp)
if err != nil {
t.Fatal(err)
}
}
func BenchmarkCompile(b *testing.B) {
inp := &peg.Node{Kids: []*peg.Node{
{Text: "h"},
{Text: "h"},
{Text: "h"},
},
}
for i := 0; i < b.N; i++ {
if _, err := Compile(inp); err != nil {
b.Fatal(err)
}
}
}
|