I previously released DoubleAgents, a test-double library for Visualworks Smalltalk.

Since the initial release, I’ve added several enhancements:

  • A DoubleAgent can now #beAnnouncer. This is useful for testing objects that expect to subscribe to announcements from a collaborator. Expect a blog post in a few weeks talking about the issues involved and why I implemented this the way I did.

  • A DoubleAgent can now #disallow: a message. This is a way to explicitly specify that a particular message will not be sent to an object. It can also override an expectation or stub that was configured in a #setUp method.

  • Expectation arguments are now matched with #=== instead of #=. This makes use of the Threequals package that I just released.

This latter change allows allows for expectations like the following:

Flexible Expectations
myDouble expect: #with:and:do:
with: (40 to: 42)
with: [:x | x even]
with: BlockClosure

This expectation will be satisfied if the arguments are some number between 40 and 42 inclusive, an even number, and a block.

As before, DoubleAgents’ primary home is the Cincom Public Store Repository. Check there for the latest version. I’ve also put a snapshot of the current version of DoubleAgents on GitHub. The Readme file on GitHub includes documentation of the API of DoubleAgents if you’d like more information before diving in.

DoubleAgents is licensed under the MIT license.