VerifiedPubSub.Subscriber.Verify (VerifiedPubSub v0.1.0)

Copy Markdown View Source

Checks at compile time that a VerifiedPubSub.Subscriber covers each event.

The handle_message/5 and ignore_message/2 calls of the module set the topics that it subscribes to. The check then tracks coverage for each {topic, event} pair as a set. An event can legally have many handle_message clauses, when they match different param values.

Coverage of param values

Coverage thus depends on event names, not on param values. When each clause for an event matches only some param values, the event still counts as covered. A message with any other value then raises FunctionClauseError at runtime. No static check can close that gap, because it is a gap in value coverage, not in name coverage. When the clauses of an event match on param values, end with a clause that matches any value.