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

Function TestHost_AddFromReader

pkg/grok/host_test.go:64–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestHost_AddFromReader(t *testing.T) {
65 s := `#
66# for testing
67#
68ONE \d
69TWO %{ONE:two}
70THREE %{ONE:one}-%{TWO}-%{ONE:three}
71
72#
73# enough
74#`
75 h := New()
76 require.NoError(t, h.AddFromReader(strings.NewReader(s)))
77 require.Len(t, h, 3)
78 _, err := h.Get("ONE")
79 require.NoError(t, err)
80 _, err = h.Get("TWO")
81 require.NoError(t, err)
82 _, err = h.Get("THREE")
83 require.NoError(t, err)
84}
85
86func TestHost_AddFromReader_malformedPatterns(t *testing.T) {
87 s := `

Callers

nothing calls this directly

Calls 5

AddFromReaderMethod · 0.80
NewFunction · 0.70
LenMethod · 0.65
GetMethod · 0.65
NewReaderMethod · 0.45

Tested by

no test coverage detected