Vanity Macros

21 views
Skip to first unread message

Robert Ericson

unread,
Jan 5, 2011, 1:25:21 AM1/5/11
to Igloo-testing
Hello all,
I just wanted to thank you for the tool.
I discovered it by the screencast at http://vimeo.com/18350401 via
reddit.com.
I liked the macros you used there so much I came up with some of my
own.

#define When(contextName) \
IGLOO_CONTEXT_REGISTRATION(contextName)

#define AndWhen(contextName, baseContextName) \
IGLOO_SUBCONTEXT_REGISTRATION(contextName, baseContextName)

#define It(specName) \
IGLOO_SPEC_REGISTRATION(specName)

That way I can:

When(it_does_not_apply_lotion){
It(gets_the_hose_again){
AssertThat(food,
Is().LessThan(needed_to_loose_weight));
}
}

Joakim Karlsson

unread,
Jan 5, 2011, 1:58:28 AM1/5/11
to igloo-...@googlegroups.com
Thanks Robert! I like what you've done.

I'm thinking we can create a separate header called igloo_spec.h or
something side by side with the core igloo.h.

We could put your behavior-like macros along with the spec-like macros
used in the screencast there.

This should enable us to ship these without risking name collisions
with other code.

/Joakim

Joakim Karlsson

unread,
Jan 7, 2011, 6:18:58 AM1/7/11
to igloo-...@googlegroups.com
I've pushed an experimental version with an alternative syntax.

The describe/it/when macros are available via the igloo_alt.h header:

#include <igloo/igloo_alt.h>
using namespace igloo;

Describe(...)
{
It(...)
};

When(...)
{
It(...)
};

I haven't done anything for the abstract test case (sub context)
aliases yet. I can't come up with a good naming scheme for that.

/J

Reply all
Reply to author
Forward
0 new messages