~/talk

Mocking in Go: Using interfaces for fun and profits

Talkat dotGo 2014 · on Friday, 2014-10-10· [testing, go]
links:none on file
slides:none on file

A small mailing system called gomez mailing server gets implemented as an interface so each component is testable in isolation. Mocking is concrete: a mock structure with matching signatures provides replaceable method fields and lets tests assert that q1 mailbox is called and parameters propagate. To hit error branches the approach injects failures for SplitHostPort and for reverse lookups. Networking either uses a handcrafted mock net.Conn with fake LocalAddr/RemoteAddr or falls back to net.Pipe limitation. This is driven by coverage-driven error injection.

AI-written summary · about

  1. 0:00Introduction
  2. 1:17Mocking Structure
  3. 2:56Mocking Addresses
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.