Fix todo support #14

merged 7 commits into from May 5, 2011


None yet

2 participants


I have exposed and documented rudimentary TODO support. This involved a few minor bug fixes and adding some documentation. The most visible changes are that

  1. The TODO variable is now accessible to all
  2. There is a new function TAP::details::failed_test_msg() that is used by the is and isnt routines to modify their output depending on whether the test is TODO or not
  3. details::error now goes to cout by default rather than cerr
  4. TODO tests are not counted as failing in the exit status value.
  5. I added documentation for the TODO variable to libtap++.pod

The TODO support is rudimentary: it doesn't handle exceptions or multiple threads running different tests, but it may be all that is really needed. When a function throws an exception you weren't expecting, the test will crash - and you'll find out about the exception just as well as you would if it were caught and you were notified directly of an unexpected exception. Further 99.9% of users don't need two different tests in the same process but different threads.

RadixSeven added some commits May 4, 2011
@RadixSeven RadixSeven Enabled basic todo functionality.
1. Made the variable TAP::TODO visible by adding an extern declaration to the header file

2. Removed unused variable TAP::todo (I guessed it was a typo)

3. Added a new function is_todo_test() to report whether the current
test is a TODO test

4. Made it so that TODO tests are not counted in the number of not_ok tests - this makes the exit status work correctly.

5. Made diagnostic messages by default go to std::cout.  This is the
default in Perl.  (Try an is or an isnt and you'll see that the
message goes to stdout).  I did this by setting TAP::details.error to
@RadixSeven RadixSeven Made diagnostic messages from is and isnt mention whether this is a t…
…odo test

The Perl diagnostics have language like "Failed (TODO) test" when
failing a todo test.  I added this to libtap++.

To add it, I had to make the TODO status visible to the is and isnt
methods, which are defined in the header file.  I thought that
TAP::details was the best place to put the interface function -- out
of the way of most users, but still where is and isnt can see it.
@RadixSeven RadixSeven Documented the use of the global TODO variable in the pod file. 250c201
@RadixSeven RadixSeven Described the use of TODO a little better and added a comma. 6c6c23d
@RadixSeven RadixSeven Fixed wrong number of tests in the documentation synopsis. 43a98b8
@RadixSeven RadixSeven Merge branch 'master' into fix_TODO_support 9edb541
@RadixSeven RadixSeven Added #define guards in the tap++ header to prevent accidental multip…
…le inclusion.

Since I sent the request, I made one more change. tap++.h had no mechanism for preventing multiple inclusion. I added #defines to do this.

@Leont Leont merged commit 05611f6 into Leont:master May 5, 2011
Leont commented May 5, 2011

Thanks, I pulled it all. One correction though: C++ doesn't have a finally block. There's a todo_guard class that uses RAII around TODO exactly for this purpose. I've added some documentation for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment