1. Matt Oswald
  2. xUnit++


Matt Oswald  committed eb42527 Draft

Edited online

  • Participants
  • Parent commits da90464
  • Branches default

Comments (0)

Files changed (1)

File TestEvents.wiki

View file
  • Ignore whitespace
 Check.Fail();   // test never executes this line
-==== The Methods ====
+=== The Methods ===
 As stated before, the test objects share the same check methods, with one exception: {{{Assert}}} offers {{{Throws}}} while {{{Check}}} and {{{Warn}}} do not.
 auto ex = Assert.Throws<std::exception>([]() { throw std::runtime_error(""); });
-==== Printing Values ====
+=== Printing Values ===
 Some methods may try to print the values of the objects using {{{to_string}}} with argument-dependent lookup (Koenig lookup). To take advantage of this, implement a {{{to_string}}} function within your object's namespace.
 If a corresponding {{{to_string}}} can't be found, xUnit++ falls back to printing the object's type with {{{typeid(obj).name()}}}.
-==== Custom Messages ====
+=== Custom Messages ===
 If you want to add a custom message to failing tests, use the overloaded {{{operator <<}}}.
 Assert.Fail() << "This is an example message " << some_value;
-==== File and Line Info ====
+=== File and Line Info ===
 Normally, when a test fails the test runner will report the file and line number for the test itself. This is typically sufficient for most tests, as tests should really only assert one thing at a time. However, if you want to be specific about which check failed, each check method accepts an optional {{{xUnitpp::LineInfo}}} object. The easiest way to do this is to pass the {{{LI}}} macro as the final parameter to the test.
 Assert.Equal(0, 1, LI) << "0 is never equal to 1!";
-==== Extra Logging ====
+=== Extra Logging ===
 If you need more logging output within the tests, use the {{{Log}}} object. Three levels of logging are implemented: Debug, Information, and Warning: