Permalink
Browse files

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
std::cout.
  • Loading branch information...
1 parent 8b173f8 commit fe325507209de1748b1b7a0b9ea9f7c3c957e6b6 @RadixSeven RadixSeven committed May 4, 2011
Showing with 6 additions and 3 deletions.
  1. +1 −1 tap++/headers/tap++.h
  2. +5 −2 tap++/source/tap++.C
@@ -183,7 +183,7 @@ namespace TAP {
return ok(!boost::is_convertible<T, U>::value, message);
}
- std::string todo;
+ extern std::string TODO;
}
#ifdef WANT_TEST_EXTRAS
@@ -23,6 +23,9 @@ namespace TAP {
return " # TODO " + TODO;
}
}
+
+ bool is_todo_test() throw() { return TODO != ""; }
+
bool is_planned = false;
bool no_planned = false;
bool has_output_plan = false;
@@ -120,7 +123,7 @@ namespace TAP {
bool ok(bool is_ok, const std::string& message) throw() {
const char* hot_or_not = is_ok ? "" : "not ";
*details::output << hot_or_not << "ok " << ++counter<< " - " << message << todo_test() << std::endl;
- if (!is_ok) {
+ if (!is_ok && !is_todo_test()) {
++not_oks;
}
return is_ok;
@@ -156,7 +159,7 @@ namespace TAP {
}
namespace details {
std::ostream* output = &std::cout;
- std::ostream* error = &std::cerr;
+ std::ostream* error = &std::cout;
static std::stack<unsigned> block_expected;
void start_block(unsigned expected) throw() {
block_expected.push(encountered() + expected);

0 comments on commit fe32550

Please sign in to comment.