MCPcopy Create free account
hub / github.com/brimdata/super / TestPattern_nestedGroups

Function TestPattern_nestedGroups

pkg/grok/pattern_test.go:36–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestPattern_nestedGroups(t *testing.T) {
37 h := New()
38 require.NoError(t, h.Add("ONE", `\d`))
39 require.NoError(t, h.Add("TWO", `(?:%{ONE:one})-(?:%{ONE:two})?`))
40 p, err := h.Get("TWO")
41 require.NoError(t, err)
42 require.Equal(t, map[string]string{"one": "1", "two": "2"}, p.Parse("1-2"))
43 require.Equal(t, map[string]string{"one": "1", "two": ""}, p.Parse("1-"))
44}
45
46func TestPattern_Names(t *testing.T) {
47 h := New()

Callers

nothing calls this directly

Calls 5

ParseMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
AddMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected