gnecula / bond

Spy-based testing library.
http://necula01.github.io/bond/
Other
7 stars 3 forks source link

[rbond] observing blocks? #9

Closed xkrogen closed 8 years ago

xkrogen commented 8 years ago

In Ruby, it's pretty common to pass a block as an argument to a method. Should we include this in our observation? If so, how? The blocks can be pretty important to the program's execution but I see no easy way to include them in observations.

gnecula commented 8 years ago

Are you thinking of spying the blocks as data, or with spy_points (as methods to be spied)? The former does not make sense, for the latter you can do if you name it.

This passing-blocks style is called higher-order programming and it is just a different way to organize the flow of control. Bond is for spying the first-order data values, not the higher-order ones. Even in Python you would not spy the lambdas.

George.

On Wed, Oct 14, 2015 at 7:50 PM, Erik notifications@github.com wrote:

In Ruby, it's pretty common to pass a block as an argument to a method. Should we include this in our observation? If so, how? The blocks can be pretty important to the program's execution but I see no easy way to include them in observations.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/9.

xkrogen commented 8 years ago

I was thinking the former, but yeah, I suppose you're right that it doesn't really make sense. Nevermind.