Page MenuHomePhabricator

Make a spies subsystem
Closed, InvalidPublic

Description

The spies are functions called inside the modules, which will create additional reports.

Event Timeline

jeblad renamed this task from Make the spies to Make a spies subsystem.Sep 10 2016, 5:17 PM

Note that there are two different ideas for how spies should work. One is to attach them to public functions, and one is to write them out in the code itself.

If they are attached to public functions it could be possible to inspect running code without messing up production code.

It would not be a problem to have both? Inline in the lib it would be like

cluck('Some import message')
mw.spy.cluck('Some important message')

while set up fom the tests it would be

cluck(foo).bar 'Some import message'
mw.spy.cluck(foo).bar 'Some import message'

In this case foo would be a table and .bar an entry pointing to a function. The later is handled by __newindex, and will get the following string and stor it within a closure for a spy on the function.