MCPcopy Create free account
hub / github.com/AdRoll/baker / TestLogLineCache

Function TestLogLineCache

logline_test.go:96–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestLogLineCache(t *testing.T) {
97 ll := &LogLine{FieldSeparator: DefaultLogLineFieldSeparator}
98
99 testCache := func() {
100 _, ok := ll.Cache().Get("foo")
101 if ok {
102 t.Errorf("ll.Cache().Get(%q) = _, %v; want _, false", "foo", ok)
103 }
104
105 ll.Cache().Set("foo", 23)
106 val, ok := ll.Cache().Get("foo")
107 if !ok || val != 23 {
108 t.Errorf("ll.Cache().Get(%q) = %v, %v; want 23, true", "foo", val, ok)
109 }
110
111 ll.Cache().Set("foo", "hello gopher")
112 val, ok = ll.Cache().Get("foo")
113 if !ok || val != "hello gopher" {
114 t.Errorf("ll.Cache().Get(%q) = %v, %v; want 23, true", "foo", val, ok)
115 }
116
117 ll.Cache().Del("foo")
118 val, ok = ll.Cache().Get("foo")
119 if ok {
120 t.Errorf("ll.Cache().Get(%q) = %v, %v; want _, false", "foo", val, ok)
121 }
122 }
123
124 testCache()
125 ll.Cache().Clear()
126 testCache()
127}
128
129func TestLogLineRecordConformance(t *testing.T) {
130 createLogLine := func() Record {

Callers

nothing calls this directly

Calls 5

CacheMethod · 0.95
DelMethod · 0.80
GetMethod · 0.65
SetMethod · 0.65
ClearMethod · 0.65

Tested by

no test coverage detected