Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Igloo - meet CppSpec..
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
dannystaple  
View profile  
 More options Oct 9 2010, 4:28 pm
From: dannystaple <orionrob...@gmail.com>
Date: Sat, 9 Oct 2010 13:28:44 -0700 (PDT)
Local: Sat, Oct 9 2010 4:28 pm
Subject: Igloo - meet CppSpec..
It is a work in progress, but as I've taken the time to learn both of
these, I have spotted the similarities and differences and thought to
write about it.

http://www.squidoo.com/cplusplus-behaviour-driven-development-tools

You here are the first to see it, and I will happily take on board any
critique or comments. I'm also preparing to do some screencasts (not
done SC's before) on getting up and running with Igloo + Boost.build.

Thanks,
Danny


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joakim Karlsson  
View profile  
 More options Oct 9 2010, 6:55 pm
From: Joakim Karlsson <joa...@jkarlsson.com>
Date: Sun, 10 Oct 2010 00:55:56 +0200
Local: Sat, Oct 9 2010 6:55 pm
Subject: Re: [igloo] Igloo - meet CppSpec..
Thanks for a great article, Danny!

It's a great description of the current state of BDD-ish testing in
C++. I'm looking forward to seeing your screencasts.

I think you describe the strengths and weaknesses of Igloo very well.
You're right about the lack of exception assertions, and that the way
exceptions are (not) being handled could be improved. What's in Igloo
today reflects what I myself had the need for in my day to day work.
So, the container constraints turned out pretty useful, at least for
me.

I like how you get the point across about the need for DSLs that focus
on describing the intention of a spec, beyond just verifying the code
under test. I seem to have a hard time convincing C++ developers that
shorter and more compact isn't always better.

/Joakim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kim Gräsman  
View profile  
 More options Oct 11 2010, 2:05 pm
From: Kim Gräsman <kim.gras...@gmail.com>
Date: Mon, 11 Oct 2010 20:05:10 +0200
Local: Mon, Oct 11 2010 2:05 pm
Subject: Re: [igloo] Igloo - meet CppSpec..
Hi Danny,

On Sat, Oct 9, 2010 at 22:28, dannystaple <orionrob...@gmail.com> wrote:
> It is a work in progress, but as I've taken the time to learn both of
> these, I have spotted the similarities and differences and thought to
> write about it.

> http://www.squidoo.com/cplusplus-behaviour-driven-development-tools

> You here are the first to see it, and I will happily take on board any
> critique or comments. I'm also preparing to do some screencasts (not
> done SC's before) on getting up and running with Igloo + Boost.build.

Thanks!

I hadn't seen CppSpec, so it was interesting to dive into. I think
CppSpec's model of specify(invoking(...),
should.raise_exception<...>()) is about as good as it gets without
C++0x lambdas.

I think we should be able to implement a similar solution in Igloo
without too much friction, but I haven't actually tried yet, so it may
be harder than it looks. It's definitely nicer than the alternatives
we've discussed earlier.

- Kim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kim Gräsman  
View profile  
 More options Oct 12 2010, 4:00 pm
From: Kim Gräsman <kim.gras...@gmail.com>
Date: Tue, 12 Oct 2010 22:00:48 +0200
Local: Tues, Oct 12 2010 4:00 pm
Subject: Re: [igloo] Igloo - meet CppSpec..
Hi guys,

On Mon, Oct 11, 2010 at 20:05, Kim Gräsman <kim.gras...@gmail.com> wrote:

> I think we should be able to implement a similar solution in Igloo
> without too much friction, but I haven't actually tried yet, so it may
> be harder than it looks. It's definitely nicer than the alternatives
> we've discussed earlier.

I've hacked up a simple prototype, inspired by CppSpec's
implementation, which allows this:

--
void dangerous()
{
  throw std::exception("hello!");

}

Context(WhenUsingThrowsConstraint)
{
        Spec(DetectsThrowingFunction)
        {
                Assert::That(Calling(dangerous), Throws<std::exception>());
        }

        Spec(FailsIfExceptionTypesMismatch)
        {
                Assert::That(Calling(dangerous), Throws<std::runtime_error>());
        }

};

--

The trick is the "Calling" function, which turns the function pointer
and possibly captured arguments (on the form "Calling(func, 1, 2)")
into a functor. That functor is then passed through Assert::That into
the Throws<> constraint, which executes it and catches any exceptions.

It doesn't play well with our Expected/Actual output mechanism, which
writes out "[unsupported type]" for the Actual, as it's an opaque
functor without any textual representation. Not sure if it's possible
to make this better in some way.

Would this be an interesting addition to Igloo, as-is, or should we
perhaps look into a macro-based strategy instead?

Cheers,
- Kim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joakim Karlsson  
View profile  
 More options Oct 12 2010, 4:14 pm
From: Joakim Karlsson <joa...@jkarlsson.com>
Date: Tue, 12 Oct 2010 22:14:27 +0200
Local: Tues, Oct 12 2010 4:14 pm
Subject: Re: [igloo] Igloo - meet CppSpec..
Cool!

Will it get messy with regards to template parameters when we start
asserting on instance methods of with different return types? Or can
the compiler deduce template parameters on calls like

class A
{
public:
  int foo();

};

A a;
Assert::That(Calling<A, int>(a, &A::foo), Throws<...>());

If we need to specify the int, I think it might be too hard to read.

/J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kim Gräsman  
View profile  
 More options Oct 12 2010, 4:21 pm
From: Kim Gräsman <kim.gras...@gmail.com>
Date: Tue, 12 Oct 2010 22:21:03 +0200
Local: Tues, Oct 12 2010 4:21 pm
Subject: Re: [igloo] Igloo - meet CppSpec..

On Tue, Oct 12, 2010 at 22:14, Joakim Karlsson <joa...@jkarlsson.com> wrote:

> Will it get messy with regards to template parameters when we start
> asserting on instance methods of with different return types? Or can
> the compiler deduce template parameters on calls like

> class A
> {
> public:
>  int foo();
> };

I can't try it without major surgery, I think, but you can't overload
on return type anyway, so it shouldn't be a problem, right?

> A a;
> Assert::That(Calling<A, int>(a, &A::foo), Throws<...>());

> If we need to specify the int, I think it might be too hard to read.

Yes, that does look terrible :-)

Hopefully, you'd get away with

   A a;
   Assert::That(Calling(a, &A::foo), Throws<...>());

But that's not exactly easy on the eyes either...

- Kim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »