ChangeLog (21295B)
1 * Fix issue 245: Modify cmake to build thread_terror on Windows with MSVC. 2 3 * Use CMake internal Threads::Threads target where needed 4 5 v41 2021-06-15 6 7 * catch2 adapter works with CATCH_CONFIG_PREFIX_ALL. 8 thanks Christian Morales Vega 9 10 * Silenced -Wreserved-identifier from Clang "latest" (13.0.0). 11 12 * Silenced (again) the MSVC C4702 warning from the default_return<>() 13 function template. 14 15 * Introduced type trompeloeil::printer<T> as a customization point or 16 formatting data to strings in reports. This has the advantage of 17 allowing partial specializations. The old technique of specializing 18 the function template trompeloeil::print(ostream&, const T&) still 19 works. 20 21 v40 2021-03-14 22 23 * Silenced -Wnonnull warning from GCC 9 and newer. Thank you Tony Neubert. 24 25 * Fixed custom reported documentation bug. Thanks Matt Godbolt. 26 27 * Added CMake alias target trompeloeil::trompeloeil. 28 Thank you Leon De Andrade. 29 30 * Documentation markdown fixes. Thank you offa. 31 32 * Moved all CI builds to github actions. travis-ci and appveyor 33 are no longer used. 34 35 * Moved CI coverage collection to codecov.io 36 37 * Conan recipe is now on https://conan.io/center/trompeloeil 38 the old rollbear/stable channel is defunct. Thank you Florian Berchtold. 39 40 v39 2020-10-31 41 42 * Fix issue 204: ALLOW_CALL was not respected in sequences. 43 Now ALLOW_CALL in sequence may be skipped, but making a 44 call out of sequence is a violation. NOTE! This fix is likely 45 to break some existing test code! 46 47 * Fix issue 211: #include <QtCore/QChar> before #include <trompeloeil.hpp> 48 caused compilation failure for all expectations. 49 50 * Fix minor spelling errors and markdownlint warnings. 51 52 * Issue 207: Extend cmake script to allow use of libc++ with g++ 53 54 * Fix issue 129: Wildcard _ does not match pass-by-value tuple 55 of only one type. 56 57 * Fix issue 197: Add override to virtual destructors 58 to avoid -Wsuggest-destructor-override warnings. 59 60 v38 2020-06-08 61 62 * Fixed bug where ALLOW_CALL only worked with sequences 63 if called at least once 64 65 * Fixed bug to support IMPLEMENT_MOCKx and IMPLEMENT_CONST_MOCKx 66 constexpr 67 68 * More fixes to Conan packaging. Thank you Kai Bernhard. 69 70 * Support OK-reporters from the runtime reporter registration 71 API. Thank you Moritz Haase. 72 73 * Rewrites to not trigger deprecation warnings in C++17 builds. 74 Thank you Kasper Laudrup. 75 76 v37 2020-02-09 77 78 * Added adapter for the Criterion unit testing framework. Thanks you 79 80 Etienne Barbier <etienne.barbier@atos.net> 81 82 * Fixes to Conan packaging. Thank you kert 83 84 * Fix issue 180 for GCC and MSVC, where the presence of a type 85 like Qt5/QChar broke compilation of unrelated mock signatures. 86 87 * Fix TROMPELOEIL_CONCAT macro issue to restore compiling with MSVC 88 when traditional preprocessor is enabled. 89 90 * Fix issue 173 for GCC 4.x by performing testing to confirm 91 correctness of existing code. 92 93 v36 2019-12-29 94 95 * Status reporting of passed expectation calls as successful assertions in 96 DOCTEST and Catch2. Thanks to: 97 98 Tore Martin Hagen <tore@instanes.name> for Catch2 99 Cristian Morales Vega <cristian@samknows.com> for DOCTEST 100 101 You get the support via the provided headers 102 103 #include <catch2/trompeloeil.hpp> 104 #include <doctest/trompeloeil.hpp> 105 106 See the CookBook for information about adding such hooks for other unit 107 testing frame works. 108 109 * Fixed issue 172 where THROW() would not compile if the function returns 110 a type that is not default constructible. 111 112 * Partially fixed issue 173, where an object constructible from nullptr 113 but not comparable with nullptr, would be constructed when printed 114 (for example when an expectation failed.) 115 116 Unfortunately this fix does not work for gcc versions 4.x or MSVC 14. 117 118 v35 2019-04-01 119 120 * Improvements to documentation. Thanks to: 121 122 Robert Dailey <rcdailey@gmail.com> 123 Yuri Timenkov <yuri@timenkov.ru> 124 Viatorus <lutztonineubert@gmail.com> 125 126 * Improved DocTest integration. Thanks to: 127 128 Cristian Morales Vega <cristian@samknows.com> 129 130 * CMakeLists.txt honours CMAKE_INSTALL_LIBDIR. Thanks to: 131 132 Cristian Morales Vega <cristian@samknows.com> 133 134 * Partially fixed issue 155, where an unfulfilled expectation, when 135 built with the default throwing reporter, terminated without a 136 message when compiled with gcc and optimization. With the partial 137 fix the program still terminates, but with the correct violation 138 message displayed. 139 140 * Fixed issue 157 where it was impossible to place an expectation on a 141 reference to a non-copyable type. This fix also resolved a number of 142 problems with older compilers. See docs/Backward.md for details. 143 144 * Fixed clang-tidy warning, misc-non-private-member-variables-in-classes 145 that leaks into application code from the Trompeloeil header. 146 147 v34 2019-04-01 148 149 * Rearranged include directory structure to make it easier to use, and 150 to write, adapters for unit test frame works. Now, if you want to 151 use Trompeloeil with, for example, the 'doctest' unit testing frame 152 work, you include 153 154 #include <doctest.h> 155 #include <doctest/trompeloeil.hpp> 156 157 The old adaptation mechanisms still work. See issue #118 158 159 * Support compilation without RTTI support. This makes error reporting 160 from deathwatched<> violations less informative (it cannot mention 161 the name of the type of the object) but has no other impact on 162 functionality. 163 164 * Silenced g++-4.9 -Wmissing-field-initializers warning with libc++. 165 166 * Fixed issue #121 where mutexes were created in each translation unit 167 168 * Fixed issue #124 where sequence objects were not properly protected 169 against access from several threads. 170 171 * Silenced several warnings in the Trompeloeil self test programs. 172 173 v33 2019-01-21 174 175 * Silenced noisy g++-7 -Wuseless-cast warning 176 177 * Fixed a bug where a mocked function would not compile if a parameter 178 had an operator==(nullptr) returning a type that is not convertible 179 to bool. 180 181 * Fixed a bug where a mocked function would not compile if a parameter 182 was a range with iterators to rvalue proxy objects, like vector<bool>. 183 184 * Mock objects can be move constructed if they have a static constexpr 185 bool member named trompeloeil_movable_mock with value = true. 186 187 * ANY() matcher gives a short descriptive compilation error message 188 when the type is an array type (it would silently decay into a 189 pointer type, which can be very confusing.) 190 191 * When compiled with preprocessor macro 192 TROMPELOEIL_USER_DEFINED_COMPILE_TIME_REPORTER, a `extern` 193 `trompeloeil::reporter` is declared from `trompeloeil.hpp`. 194 Thanks @rcdailey 195 196 * Minor documentation updates. 197 198 * Update pattern in expectation_with_wrong_type.cpp to match 199 new error message from GCC '9' at svn revision 264700. 200 201 v32 2018-07-23 202 203 * Fix issue #95: check_errors.sh typo and detect failure in Travis 204 205 * Update unit test framework to Catch 2.2.3. 206 207 * Fix documentation of sanitize flags 208 209 * Enable destructor override warning in self_test build for Clang 5.0 210 or later 211 212 * Update unit test framework to Catch 2.2.1. 213 214 * Worked around clang++-6 bugs 38010 and 38033 215 216 * Improve support for compiler modes: 217 GCC and Clang: -std=c++17; MSVC: /std:c++17 218 GCC and Clang: -std=c++2a; MSVC: /std:c++latest 219 220 * Fix issue #87: C4355 warning from VS Release builds. Thanks @Neargye 221 222 * Fix issue #69: work around C4702 warning from VS Release builds. 223 224 * Fix issue #88: work around C2066 error from VS 2017 15.7.1. 225 226 v31 2018-05-11 227 228 * Issue #83: Add AppVeyor support for VS 2015 and VS 2017 229 230 * Fix issue #82: restore compilation with VS 2015. 231 232 233 v30 2018-04-02 234 235 * mock_interface<T> provides a convenient short cut when implementing 236 mocks from interfaces. It is used together with the macros 237 IMPLEMENT_MOCKn(func_name) and IMPLEMENT_CONST_MOCKn(func_name). 238 The signature of the function is deduced. It is not possible to use 239 mock_interface<T> with multiple inheritance, and it is not possible 240 to mock overloads with IMPLEMENT_MOCKn(func_name) or 241 IMPLEMENT_CONST_MOCKn(func_name) 242 243 * Used markdownlint to make documentation more consistent. Thanks @AndrewPaxie 244 245 * Silenced 2 clang++-5 warnings about missing "override" 246 247 Back ported Trompeloeil to C++11. Thanks @AndrewPaxie! 248 Changes by file and directory: 249 * Cleaned up `.travis.yml` 250 * Cleaned up `CMakeLists.txt` and bumped kcov for travis builds 251 * `README.md` 252 * Updated supported compiler list. 253 * Added link to `docs/Backward.md`. 254 * Added link to `docs/PlatformAndLibraries.md`. 255 * `check_errors.sh` require `CXXFLAGS` with either `-std=c++11` or `-std=c++14`. 256 * `docs/FAQ.md` 257 * Updated supported compilers list. 258 * Updated answer regarding C++11 support. 259 * `docs/` 260 * New: "Backward compatibility with earlier versions of C++". 261 * New: "Platform and library support for Trompeloeil". 262 * `compilation_errors/` 263 * Support for C++11 expectation syntax in test cases. 264 * `test/` 265 * Split `compiling_tests.cpp` into separately compilable files, 266 for Catch main, C++11 test cases and C++14 test cases. 267 268 * Fixed whitespace and a minor spelling error in trompeloeil.hpp. 269 * Tidy up test cases in compilation_errors. 270 271 v29 2017-07-23 272 273 * Fix Issue #54: Exception thrown exit - fixed static dtor fiasco 274 * Fix Issue #48: Move "re" in lambda capture list in "regex_check". 275 * Fix Issue #55: Restore warnings for Clang builds. 276 * Correct spelling of SANITIZE for clang Xcode builds. 277 * Fix Issue #57: Avoid unneeded-member-function warning from Clang. 278 * Allow only standard C++ dialects in Trompeloeil test programs. 279 * Lightly edited documentation. 280 281 v28 2017-07-24 282 283 * You can place expectations on types multiply inheriting several 284 mock types. 285 286 * Changed directory structure. "trompeloeil.hpp" now resides in 287 directory "include". Self test programs "compiling_tests.cpp" 288 and "thread_terror.cpp" resides in directory "test". 289 290 * Major work on CMake support 291 - "make install" - works as before and also includes a package 292 - For CMake based project you can use 293 . "find_package(trompeloeil 28 REQUIRED)" and add 294 "target_link_libraries(<test_program> trompeloeil)" for your test 295 target 296 . use "add_subdirectory(trompeloeil)" if you prefer to track 297 the trompeloeil git repository and also here add 298 "target_link_libraries(<test_program> trompeloeil)" for your test 299 target 300 - "cmake -DBUILD_TYPE=Debug <trompeloeil-dir>" enables the test 301 targets "self_test" and "thread_terror" 302 . "-DSANITIZE" enables ASAN and UBSAN for "self_test", and TSAN and 303 UBSAN for "thread_terror" 304 305 v27 2017-06-27 306 307 * Fixed a regression where NAMED_REQUIRE_DESTRUCTION(obj) accidentally 308 resulted in a std::unique_ptr<trompeloeil::expectation> instead 309 of std::unique_ptr<trompeloeil::lifetime_monitor> as documented. 310 311 * Added a rudimentary CMakeLists.txt file. Thanks Harald Achitz. 312 313 v26 2017-06-12 314 315 * Support for threaded semi-integration tests by allowing 316 queries if a sequence object "is_completed()", if an 317 expectation objet "is_satisfied()" or "is_saturated()". 318 319 See FAQ and reference manual for details. 320 321 * Internal restructuring for reduced code size. 322 323 v25 2017-04-17 324 325 * Changed the expectation macros such that you can now have a 326 macro that expands into several REQUIRE_CALL() (and the likes) 327 328 * Fixed macro expansion bugs causing name clashes. 329 330 * Documented clang++ 4 compatibility 331 332 * Sequence objects are now movable and can, for example, be 333 returned from functions. 334 335 v24 2017-03-10 336 337 * Worked around VS2017 bug. Thanks mlimber and xiangfan-ms 338 339 v23 2017-01-29 340 341 * Matchers can be negated using the logical not operator !. 342 343 Example: 344 345 struct Mock { 346 MAKE_MOCK1(func, void(const std::string&)); 347 }; 348 349 TEST(...) 350 { 351 using trompeloeil::re; // match regular expressions 352 Mock m; 353 REQUIRE_CALL(m, func(!re("^foo"))); 354 // calls to func with strings not matching the regex /^foo/ 355 ... 356 } 357 358 * Made sequence and its dependencies moveable. (mlimber) 359 360 This means it's now possible to use tha Almost Always Auto 361 style for sequence objects: 362 363 auto seq = trompeloeil::sequence{}; 364 365 * Internal refactoring for substantially reduced compilation time. 366 367 v22 2016-12-13 368 369 * Messages from violations of expectations now print collections 370 member wise. This goes for std::pair<>, std::tuple<> and any data 371 type for which a range based for loop is possible. This is done 372 recursively for the contents of the collections. 373 374 * Worked around gcc bug 78446 375 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78446 376 377 * Cleaned up -Wshadow warnings from gcc 378 379 v21 2016-11-13 380 381 * Tracing now includes return values and exceptions thrown. 382 For exception types inherited from std::exception, the 383 what() string is printed. 384 385 * Fixed a bug when a member function in a mocked class calls 386 a mocked function. This is now explicitly allowed, even 387 when an expectation recursively calls the same function 388 as a side effect. 389 390 * Worked around VisualStudio 2015 update 3 issue where trailing 391 return type for lambdas is not respected in template deduction 392 context. This caused compilation errors when using matchers 393 in expectations to overloaded functions. 394 395 * Worked around VisualStudio 2015 update 3 issue with evaluating 396 regex_search() in trailing return type spec for auto deduced 397 string type. 398 399 v20 2016-10-05 400 401 * Fixed harmless but very very annoying warning from clang++ 402 403 v19 2016-10-03 404 405 * Fixed obscure bug when placing an expectation using a value implicitly 406 convertible to the target type, but not equal comparable with it. 407 408 Example: 409 410 struct S 411 { 412 S(const char* s_) : s(s_) {} 413 bool operator(const char*) = delete; 414 bool operator==(const S& rh) const 415 { 416 return s == rh.s; 417 } 418 std::string s; 419 }; 420 421 struct mock { 422 MAKE_MOCK1(func, void(S)); 423 }; 424 425 TEST(...) 426 { 427 mock m; 428 REQUIRE_CALL(m, func("string")); 429 // now compiles and compares the function call parameter value 430 // with S("string") 431 } 432 433 * Improved compilation error messages for type-mismatch 434 situations in .RETURN() 435 436 v18 2016-08-18 437 438 * Writing custom matchers is much simplified through the use 439 of function template make_matcher<>, which accepts lambdas 440 for predicate and printing error message. 441 442 The old technique of inheriting form trompeloeil::matcher 443 or trompeloeil::typed_matcher<T> still works. 444 445 * Further internal restructuring for yet reduced test program 446 build time. 447 448 v17 2016-06-11 449 450 * Use template specialization when writing adapter code for unit 451 testing frame works. 452 453 * Internal restructuring for shorter compilation times. 454 455 v16 2016-05-16 456 457 * class trompeloeil::lifetime_monitor now inherits from 458 class trompeloeil::expectation, so using 459 460 std::unique_ptr<expectation> p = NAMED_REQUIRE_DESTRUCTION(obj); 461 462 instead of 463 464 std::unique_ptr<lifetime_monitor> p = NAMED_REQUIRE_DESTRUCTION(obj); 465 466 works equally well, reduces the cognitive load a bit, and seems to 467 build slightly faster. 468 469 * .IN_SEQUENCE(...) can now be used with REQUIRE_DESTRUCTION(...) 470 and NAMED_REQUIRE_DESTRUCTION(...) to ensure objects are 471 destroyed in the intended order. Example: 472 473 auto p1 = new trompeloeil::deathwatched<mock1>; 474 auto p2 = new trompeloeil::deathwatched<mock2>; 475 476 trompeloeil::sequence s; 477 REQUIRE_DESTRUCTION(*p1) 478 .IN_SEQUENCE(s); 479 REQUIRE_DESTRUCTION(*p2) 480 .IN_SEQUENCE(s); 481 call_destroyer(p1, p2); // both must be destroyed, p1 before p2. 482 483 v15 2016-04-29 484 485 * Fixed macro bug that caused warnings with g++ and clang++ when 486 compiling with strict C++ standards compliance. 487 488 v14 2016-04-27 489 490 * Fixed bug when the destruction of a sequence object with still 491 living expectations caused call to abort(). 492 493 * You can now add extra trailing specifiers to a mock function, 494 such as the "override" context sensitive specifier, and/or the 495 keyword "noexcept" (careful with the latter if your registered 496 reporter can/does throw.) 497 498 Example: 499 500 struct D : public B { 501 MAKE_MOCK1(func, int(int), override); 502 }; 503 504 505 v13 2016-03-07 506 507 * Mock functions and their expectations are thread safe, using 508 a global recursive mutex. 509 510 * Silenced warnings from g++ -Wshadow. 511 512 v12 2016-02-01 513 514 * Built in matchers are duck typed by default, i.e. eq, ne, gt, ge, 515 lt, le do by default match any parameter that supports operators 516 ==, !=, >, >=, <, <= with the value provided. If needed for 517 disambiguation of overloads an explicit type can be provided. Example: 518 519 REQUIRE_CALL(obj, numfunc(gt(3))); 520 REQUIRE_CALL(obj, strfunc(eq<std::string&>("foo"))); 521 522 The expectation on numfunc will match a function numfunc with 523 any parameter type that can be compared as > 3. The expectation on 524 strfunc will only match an overload with std::string& (if there are 525 competing overloads, e.g. strfunc(const char*) and 526 strfunc(const std::string).) 527 528 * Fixed a bug with return type deduction where an array type expression 529 was used. E.g. returning a string literal when the return type was 530 const char* or std::string caused a compilation error. 531 532 * Fixed a bug when the eq(nullptr) matcher actually checked if != 533 comparison with nullptr was allowed. 534 535 * Reluctantly reverted use of std::tuple_element_t<> for 536 typename tuple_element<>::type, to support g++ 4.9.0 (4.9.1 does have 537 std::tuple_element_t<>.) 538 539 v11 2016-01-04 540 541 * Added regular expression matcher for std::string and c-strings 542 543 * Added specialization eq<nullptr> for pointer-like parameters and 544 pointer-to-member parameters. This is mostly useful for 545 pointer to pointer parameters, e.g.: 546 547 REQUIRE_CALL(obj, func(*trompeloeil::eq(nullptr))); 548 549 * Improved accuracy of compilation error message when attempting 550 to place expectation that does not uniquely match any function 551 signature. 552 553 * Added specialization eq<nullptr> for pointer-like parameters and 554 v10 2015-12-11 555 556 * Fixed bug when wildcard _ could not match std::ostream& 557 558 * Fixed ADL bugs 559 560 * Added functionality to use the dereference operator (prefix 561 operator*) on any matcher to instead match a pointer to the 562 value to check. 563 564 * Documented adapter for VisualStudio MSTest 565 566 * Corrected documentation bug for how to write report formatting 567 function trompeloeil::print<>(std::ostream&, T const&). 568 569 v9 2015-11-29 570 571 * Fixed bug with accepting std::unique_ptr<> by value. 572 573 * Signed/unsigned compilation warnings in expectations are attributed 574 to correct file/line with clang++ and VisualStudio 2015 575 576 * Complete documentation overhaul. Now with: 577 - Cook book 578 - FAQ 579 - reference manual 580 581 * Better compilation error message when illegal argument is 582 used in expectation. 583 584 * Addressed clang++ and VisualStudio warnings 585 586 v8 2015-10-30 587 588 * Fixed bug when mock object was destroyed with a saturated 589 expectation in scope. 590 591 * Further improved compilation error messages. 592 593 v7 2015-10-24 594 595 * Report error if live expectations remain when a mock object is 596 destroyed 597 598 * Reduced clutter in compilation errors 599 600 * Allow mock objects to be templates. E.g. 601 602 template <typename T> 603 struct mock 604 { 605 MAKE_MOCK1(func, void(T)); 606 }; 607 608 Note that member function templates are still not supported. 609 610 611 v6 2015-09-22 612 613 * Verified support for released Visual Studio 2015 614 615 * trompeloeil::ne(nullptr) works for all pointer types 616 617 * Fixed a few issues reported by clang 3.7 sanitizers 618 619 * line number in reporter_func is unsigned long to match 620 type of __LINE__ 621 622 623 v5 2015-06-19 624 625 * Support for Visual Studio 2015 RC 626 627 * 5 parameter value matchers are included. These are 628 (in namespace trompeloeil): 629 - ne(x) - not equal to x 630 - lt(x) - less than x 631 - le(x) - less than or equal to x 632 - gt(x) - greater than x 633 - ge(x) - greater than or equal to x 634 635 These are used in expectations as e.g.: 636 637 REQUIRE_CALL(obj, foo(ne(5))); 638 639 which matches calls to foo with a value not equal to 5. 640 641 * Support and documentation for how to write custom matchers. 642 643 * The function registered to set_reporter() now must accept 644 the source location as file, line instead of location as 645 a combined string. Apologies for breaking existing code, 646 but since this is more in line with how other frame works 647 refers to source code locations, it improves compatibility. 648 649 v4 2015-05-01 650 651 * Expectations of death do not follow move-constructed and 652 copy-constructed deathwatched<T> objects. 653 654 * Internal rewrites to reduce compilation times 655 656 v3 2015-04-02 657 658 * Fixed compiler dependent reference binding SNAFU 659 660 v2 2015-04-02 661 662 * Improved compilation time performance. 20% drop in compilation time 663 has been seen in some test programs. 664 665 * Improved the compiler's chance to provide good warning messages 666 when values in expectations don't quite the types used in the 667 function signature (for example signed/unsigned mismatch.) 668 669 * Added support for tracing matching calls. This is an aid when 670 doing exploratory tests of legacy code. A trace can often 671 drastically reduce the time required to understand how the legacy 672 code works. 673 674 To use it, create an object of a tracer type, for example: 675 676 TEST(atest) 677 { 678 trompeloeil::stream_tracer trace(std::cout); 679 680 // normal test code 681 } 682 683 v1 2015-01-10 684 685 First official release.