-
Notifications
You must be signed in to change notification settings - Fork 86
/
ChangeLog
905 lines (603 loc) · 28.5 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
v49 2024-10-07
* Added mocking macros that infers function arity from a trailing return
type syntax signature.
MAKE_MOCK(name, signature {, specifiers})
MAKE_CONST_MOCK(name, signature {, specifiers})
MAKE_STDMETHOD_MOCK(name, signature {, specifiers})
Note that these only work with trailing return type syntax. Examples
of specifiers are 'override', 'final' and 'noexcept'
The preprocessor is limited and can only handle nullary functions,
i.e. functions that do not accept any arguments, in some cases.
MSVC handles nullary functions when compiling with /Zc:preprocessor
with MSVC 19.40 (VS 17.10) or later.
Gcc and Clang always handles nullary functions when compiling with
C++20 or later, and when enabling a gcc extension by compiling with
-std=gnu++11/14/17 and defining the macro TROMPELOEIL_HAS_GCC_PP before
#include:ing the trompeloeil headers.
* Added .RT_TIMES() to exceptations, which works like .TIMES()
but where the limits are only known at runtime. Thank you
Dominic Koepke for submitting the implementation.
* Added several new composable matchers.
range matchers range_includes(*elements*), range_is(*elements*),
range_is_permutation(*elements*), range_all_of(*comparator*),
range_none_of(*comparator*), range_any_of(*comparator*),
range_starts_with(*elements*) and range_ends_with(*elements*).
Use in expectations as:
REQUIRE_CALL(obj, vector_func(range_starts_with(2,3,5,8)));
MEMBER_IS(ptr_to_mem, matcher). Use as:
REQUIRE_CALL(obj, func(MEMBER_IS(&type::height, gt(5)));
all_of(matchers), any_of(matchers), none_of(matchers). Use as:
REQUIRE_CALL(obj, func(any_of(-1, gt(0))));
These can be composed like:
REQUIRE_CALL(obj, func(range_all_of(
any_of(MEMBER_IS(&type::x, -1),
MEMBER_IS(&type::y, gt(0))))));
Thank you Artem for the suggestion.
* When an expectation is constrained by several .WITH() clauses, a
violation report will only include the first failed condition,
short cirquiting the login.
Example:
REQUIRE_CALL(obj, func(_))
.WITH(_1 != nullptr)
.WITH(*_1 == 0); // would be runtime crash on nullptr access
Thank you Örjan Gustavsson for the suggestion.
v48 2024-07-17
* Fixed memory leak when adding an action (.RETURN, .SIDE_EFFECT, etc)
throws. Thank you Dominic Koepke for the fix.
* Dropped older compilers from CI builds (gcc <= 6 and clang <= 7) since
GitHub actions now require node-20, and no build environment is
currently available that both supports node-20 and older compilers.
* Support for STDMETHOD functions for COM. Thank you Luis Andres Cesena
for the implementation, and Kevin Puetz for the discussions. This
adds new macros:
MAKE_STDMETHOD_MOCKn(...)
IMPLEMENT_STDMETHOD_MOCKn(...)
* Fixed issue with std::expected causing compilation error. Thank you
@subbota-a for reporting
* Silenced gcc -Weffc++ warnings. Thanks Sven Fischer for the report
v47 2024-01-01
* Coroutines are conditionally supported by the __cpp_impl_coroutine
feature test macro. There is no longer any need to define the
TROMPELOEIL_EXPERIMENTAL_COROUTINES macro in order to use coroutines
with Trompeloeil.
* Split the monolithic "trompeloeil.hpp" into several smaller
headers. You can continue to #include <trompeloeil.hpp> as usual,
but you can also do more fine grained #include:s, which may
improve build times. E.g.:
#include <trompeloeil/mock.hpp> // basic mock functionality
#include <trompeloeil/lifetime.hpp> // REQUIRE_DESTRUCTION etc.
#include <trompeloeil/matcher/re.hpp> // regular expressions
The reference manual says which header to include to get the
functionality for each item. If no header is mentioned, it is in
<trompeleil/mock.hpp>
v46 2023-11-06
* Experimental support for coroutines. Use CO_RETURN (or LR_CO_RETURN)
for a member function that has a coroutine return type. Use CO_THROW
(or LR_CO_THROW) to throw from a coroutine. Use as many CO_YIELD
(or LR_CO_YIELD) from a coroutine function as you like, as long as the
promise type supports it.
The experimental support must be explicitly enabled with
#define TROMPELOEIL_EXPERIMENTAL_COROUTINES
#include <trompeloeil.hpp>
alternatively
#define TROMPELOEIL_EXPERIMENTAL_COROUTINES
#include <trompeloeil/mock.hpp>
#include <trompeloeil/coro.hpp>
trompeloeil::stream_tracer does not produce correct result for
coroutines
* Corrected output of input-range like types. Thank you Dominic Koepke for
the fix.
* The self test program "custom_recursive_mutex" now says that it's
succeeded. Thank you @yurivict for reporting the confusion.
* Self test programs are only build when explicitly setting
-DTROMPELOEIL_BUILD_TESTS=yes to the CMake command line.
* The self test programs require a higher version of CMake (3.19
currently)
v45 2023-07-21
* Support matching regular expressions to std::string view
* Added adapter for QA Systems Cantata. Thank you Andreas Schätti
v44 2023-04-10
* Fixed issue 293: Wildcard _ could not match types that can be
constructed from any type. This fix unfortunately turns off conversion
warnings for REQUIRE_CALL and friends when building with gcc. Thank
you @TimonNoethlichs for reporting.
* Fixed issue 296: Improved sequence violation message when ALLOW_CALL
is involved. Thank you Sigurður Sveinn Halldórsson for reporting.
* Fixed -Wunsafe-buffer-usage warning from clang-16
* static_assert() when trying to get a runtime value from any matcher
* Bumped required CMake version to 3.14 or later. Thank you Luke Dennis
for reporting.
v43 2022-10-26
* Added static_assert to duck_typed_matcher's templatized conversion
function explaining why it should never be instantiated. Issue 270.
* Added gcc-12 and clang++-15 to the CI build matrix
* Fixed issue 272: Support Catch2 piecemeal headers.
* Fix issue #279 where the doctest adapter showed violation messages
as hex addresses for most recent releases of doctest. Thanks
@SimonKagstrom for reporting.
* Fixed an obscure bug where an expectation could match with a sequence
object that has run to completion.
* Specify ARCH_INDEPENDENT when creating package version file in CMake.
v42 2021-12-07
* Fixed issue 264: Sequence objects did not correctly report
is_complete() when there were living, but satisfied, expectations
remaining. Thank you Václav Kubernát for reporting.
* Fixed issue 259 where CMakeFiles.txt wrongly installed trompeloeil
for projects that includes it. It is now an option. See FAQ for
details. Thank you Ismail Pazarbasi for reporting and fixing.
* Updated Catch2 to version 2.13.7 to compile unit tests on systems
with glibc >= 2.34.
* Fixed issue 255: Hex dumps showed byte values <= 15(dec) wrong.
Thank you Stuart Dootson for reporting.
* Fixed issue 253: Resolve lingering warnings in early Clang compilers
and enable -Wzero-as-null-pointer-constant when compiling unit tests
with GCC and Clang.
* Fixed issue 250: Warnings about zero argument variadic macros with
clang-msvc. Thank you u3shit for reporting and fixing.
* Fixed issue 251: trompeloeil::printer<> customization point now
supports SFINAE expressions to constrain partial specializations.
Thank you Christian Morales Vega for reporting.
* Fixed issue 245: Modify cmake to build thread_terror on Windows with
MSVC.
* Use CMake internal Threads::Threads target where needed. Thank you
Martin Hořeňovský for reporting.
* For CI builds, use github actions cacheing of built libc++ to shorten
build times.
* Added CMake install namespace. Thank you offa
* Fixed bug where an expectation end of life was reported as an error
if it was included in a satisfied sequence. Thank you Andy Saul.
v41 2021-06-15
* catch2 adapter works with CATCH_CONFIG_PREFIX_ALL.
thanks Christian Morales Vega
* Silenced -Wreserved-identifier from Clang "latest" (13.0.0).
* Silenced (again) the MSVC C4702 warning from the default_return<>()
function template.
* Introduced type trompeloeil::printer<T> as a customization point or
formatting data to strings in reports. This has the advantage of
allowing partial specializations. The old technique of specializing
the function template trompeloeil::print(ostream&, const T&) still
works.
v40 2021-03-14
* Silenced -Wnonnull warning from GCC 9 and newer. Thank you Tony Neubert.
* Fixed custom reported documentation bug. Thanks Matt Godbolt.
* Added CMake alias target trompeloeil::trompeloeil.
Thank you Leon De Andrade.
* Documentation markdown fixes. Thank you offa.
* Moved all CI builds to github actions. travis-ci and appveyor
are no longer used.
* Moved CI coverage collection to codecov.io
* Conan recipe is now on https://conan.io/center/trompeloeil
the old rollbear/stable channel is defunct. Thank you Florian Berchtold.
v39 2020-10-31
* Fix issue 204: ALLOW_CALL was not respected in sequences.
Now ALLOW_CALL in sequence may be skipped, but making a
call out of sequence is a violation. NOTE! This fix is likely
to break some existing test code!
* Fix issue 211: #include <QtCore/QChar> before #include <trompeloeil.hpp>
caused compilation failure for all expectations.
* Fix minor spelling errors and markdownlint warnings.
* Issue 207: Extend cmake script to allow use of libc++ with g++
* Fix issue 129: Wildcard _ does not match pass-by-value tuple
of only one type.
* Fix issue 197: Add override to virtual destructors
to avoid -Wsuggest-destructor-override warnings.
v38 2020-06-08
* Fixed bug where ALLOW_CALL only worked with sequences
if called at least once
* Fixed bug to support IMPLEMENT_MOCKx and IMPLEMENT_CONST_MOCKx
constexpr
* More fixes to Conan packaging. Thank you Kai Bernhard.
* Support OK-reporters from the runtime reporter registration
API. Thank you Moritz Haase.
* Rewrites to not trigger deprecation warnings in C++17 builds.
Thank you Kasper Laudrup.
v37 2020-02-09
* Added adapter for the Criterion unit testing framework. Thanks you
Etienne Barbier <[email protected]>
* Fixes to Conan packaging. Thank you kert
* Fix issue 180 for GCC and MSVC, where the presence of a type
like Qt5/QChar broke compilation of unrelated mock signatures.
* Fix TROMPELOEIL_CONCAT macro issue to restore compiling with MSVC
when traditional preprocessor is enabled.
* Fix issue 173 for GCC 4.x by performing testing to confirm
correctness of existing code.
v36 2019-12-29
* Status reporting of passed expectation calls as successful assertions in
DOCTEST and Catch2. Thanks to:
Tore Martin Hagen <[email protected]> for Catch2
Cristian Morales Vega <[email protected]> for DOCTEST
You get the support via the provided headers
#include <catch2/trompeloeil.hpp>
#include <doctest/trompeloeil.hpp>
See the CookBook for information about adding such hooks for other unit
testing frame works.
* Fixed issue 172 where THROW() would not compile if the function returns
a type that is not default constructible.
* Partially fixed issue 173, where an object constructible from nullptr
but not comparable with nullptr, would be constructed when printed
(for example when an expectation failed.)
Unfortunately this fix does not work for gcc versions 4.x or MSVC 14.
v35 2019-04-01
* Improvements to documentation. Thanks to:
Robert Dailey <[email protected]>
Yuri Timenkov <[email protected]>
Viatorus <[email protected]>
* Improved DocTest integration. Thanks to:
Cristian Morales Vega <[email protected]>
* CMakeLists.txt honours CMAKE_INSTALL_LIBDIR. Thanks to:
Cristian Morales Vega <[email protected]>
* Partially fixed issue 155, where an unfulfilled expectation, when
built with the default throwing reporter, terminated without a
message when compiled with gcc and optimization. With the partial
fix the program still terminates, but with the correct violation
message displayed.
* Fixed issue 157 where it was impossible to place an expectation on a
reference to a non-copyable type. This fix also resolved a number of
problems with older compilers. See docs/Backward.md for details.
* Fixed clang-tidy warning, misc-non-private-member-variables-in-classes
that leaks into application code from the Trompeloeil header.
v34 2019-04-01
* Rearranged include directory structure to make it easier to use, and
to write, adapters for unit test frame works. Now, if you want to
use Trompeloeil with, for example, the 'doctest' unit testing frame
work, you include
#include <doctest.h>
#include <doctest/trompeloeil.hpp>
The old adaptation mechanisms still work. See issue #118
* Support compilation without RTTI support. This makes error reporting
from deathwatched<> violations less informative (it cannot mention
the name of the type of the object) but has no other impact on
functionality.
* Silenced g++-4.9 -Wmissing-field-initializers warning with libc++.
* Fixed issue #121 where mutexes were created in each translation unit
* Fixed issue #124 where sequence objects were not properly protected
against access from several threads.
* Silenced several warnings in the Trompeloeil self test programs.
v33 2019-01-21
* Silenced noisy g++-7 -Wuseless-cast warning
* Fixed a bug where a mocked function would not compile if a parameter
had an operator==(nullptr) returning a type that is not convertible
to bool.
* Fixed a bug where a mocked function would not compile if a parameter
was a range with iterators to rvalue proxy objects, like vector<bool>.
* Mock objects can be move constructed if they have a static constexpr
bool member named trompeloeil_movable_mock with value = true.
* ANY() matcher gives a short descriptive compilation error message
when the type is an array type (it would silently decay into a
pointer type, which can be very confusing.)
* When compiled with preprocessor macro
TROMPELOEIL_USER_DEFINED_COMPILE_TIME_REPORTER, a `extern`
`trompeloeil::reporter` is declared from `trompeloeil.hpp`.
Thanks @rcdailey
* Minor documentation updates.
* Update pattern in expectation_with_wrong_type.cpp to match
new error message from GCC '9' at svn revision 264700.
v32 2018-07-23
* Fix issue #95: check_errors.sh typo and detect failure in Travis
* Update unit test framework to Catch 2.2.3.
* Fix documentation of sanitize flags
* Enable destructor override warning in self_test build for Clang 5.0
or later
* Update unit test framework to Catch 2.2.1.
* Worked around clang++-6 bugs 38010 and 38033
* Improve support for compiler modes:
GCC and Clang: -std=c++17; MSVC: /std:c++17
GCC and Clang: -std=c++2a; MSVC: /std:c++latest
* Fix issue #87: C4355 warning from VS Release builds. Thanks @Neargye
* Fix issue #69: work around C4702 warning from VS Release builds.
* Fix issue #88: work around C2066 error from VS 2017 15.7.1.
v31 2018-05-11
* Issue #83: Add AppVeyor support for VS 2015 and VS 2017
* Fix issue #82: restore compilation with VS 2015.
v30 2018-04-02
* mock_interface<T> provides a convenient short cut when implementing
mocks from interfaces. It is used together with the macros
IMPLEMENT_MOCKn(func_name) and IMPLEMENT_CONST_MOCKn(func_name).
The signature of the function is deduced. It is not possible to use
mock_interface<T> with multiple inheritance, and it is not possible
to mock overloads with IMPLEMENT_MOCKn(func_name) or
IMPLEMENT_CONST_MOCKn(func_name)
* Used markdownlint to make documentation more consistent. Thanks @AndrewPaxie
* Silenced 2 clang++-5 warnings about missing "override"
Back ported Trompeloeil to C++11. Thanks @AndrewPaxie!
Changes by file and directory:
* Cleaned up `.travis.yml`
* Cleaned up `CMakeLists.txt` and bumped kcov for travis builds
* `README.md`
* Updated supported compiler list.
* Added link to `docs/Backward.md`.
* Added link to `docs/PlatformAndLibraries.md`.
* `check_errors.sh` require `CXXFLAGS` with either `-std=c++11` or `-std=c++14`.
* `docs/FAQ.md`
* Updated supported compilers list.
* Updated answer regarding C++11 support.
* `docs/`
* New: "Backward compatibility with earlier versions of C++".
* New: "Platform and library support for Trompeloeil".
* `compilation_errors/`
* Support for C++11 expectation syntax in test cases.
* `test/`
* Split `compiling_tests.cpp` into separately compilable files,
for Catch main, C++11 test cases and C++14 test cases.
* Fixed whitespace and a minor spelling error in trompeloeil.hpp.
* Tidy up test cases in compilation_errors.
v29 2017-07-23
* Fix Issue #54: Exception thrown exit - fixed static dtor fiasco
* Fix Issue #48: Move "re" in lambda capture list in "regex_check".
* Fix Issue #55: Restore warnings for Clang builds.
* Correct spelling of SANITIZE for clang Xcode builds.
* Fix Issue #57: Avoid unneeded-member-function warning from Clang.
* Allow only standard C++ dialects in Trompeloeil test programs.
* Lightly edited documentation.
v28 2017-07-24
* You can place expectations on types multiply inheriting several
mock types.
* Changed directory structure. "trompeloeil.hpp" now resides in
directory "include". Self test programs "compiling_tests.cpp"
and "thread_terror.cpp" resides in directory "test".
* Major work on CMake support
- "make install" - works as before and also includes a package
- For CMake based project you can use
. "find_package(trompeloeil 28 REQUIRED)" and add
"target_link_libraries(<test_program> trompeloeil)" for your test
target
. use "add_subdirectory(trompeloeil)" if you prefer to track
the trompeloeil git repository and also here add
"target_link_libraries(<test_program> trompeloeil)" for your test
target
- "cmake -DBUILD_TYPE=Debug <trompeloeil-dir>" enables the test
targets "self_test" and "thread_terror"
. "-DSANITIZE" enables ASAN and UBSAN for "self_test", and TSAN and
UBSAN for "thread_terror"
v27 2017-06-27
* Fixed a regression where NAMED_REQUIRE_DESTRUCTION(obj) accidentally
resulted in a std::unique_ptr<trompeloeil::expectation> instead
of std::unique_ptr<trompeloeil::lifetime_monitor> as documented.
* Added a rudimentary CMakeLists.txt file. Thanks Harald Achitz.
v26 2017-06-12
* Support for threaded semi-integration tests by allowing
queries if a sequence object "is_completed()", if an
expectation objet "is_satisfied()" or "is_saturated()".
See FAQ and reference manual for details.
* Internal restructuring for reduced code size.
v25 2017-04-17
* Changed the expectation macros such that you can now have a
macro that expands into several REQUIRE_CALL() (and the likes)
* Fixed macro expansion bugs causing name clashes.
* Documented clang++ 4 compatibility
* Sequence objects are now movable and can, for example, be
returned from functions.
v24 2017-03-10
* Worked around VS2017 bug. Thanks mlimber and xiangfan-ms
v23 2017-01-29
* Matchers can be negated using the logical not operator !.
Example:
struct Mock {
MAKE_MOCK1(func, void(const std::string&));
};
TEST(...)
{
using trompeloeil::re; // match regular expressions
Mock m;
REQUIRE_CALL(m, func(!re("^foo")));
// calls to func with strings not matching the regex /^foo/
...
}
* Made sequence and its dependencies moveable. (mlimber)
This means it's now possible to use tha Almost Always Auto
style for sequence objects:
auto seq = trompeloeil::sequence{};
* Internal refactoring for substantially reduced compilation time.
v22 2016-12-13
* Messages from violations of expectations now print collections
member wise. This goes for std::pair<>, std::tuple<> and any data
type for which a range based for loop is possible. This is done
recursively for the contents of the collections.
* Worked around gcc bug 78446
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78446
* Cleaned up -Wshadow warnings from gcc
v21 2016-11-13
* Tracing now includes return values and exceptions thrown.
For exception types inherited from std::exception, the
what() string is printed.
* Fixed a bug when a member function in a mocked class calls
a mocked function. This is now explicitly allowed, even
when an expectation recursively calls the same function
as a side effect.
* Worked around VisualStudio 2015 update 3 issue where trailing
return type for lambdas is not respected in template deduction
context. This caused compilation errors when using matchers
in expectations to overloaded functions.
* Worked around VisualStudio 2015 update 3 issue with evaluating
regex_search() in trailing return type spec for auto deduced
string type.
v20 2016-10-05
* Fixed harmless but very very annoying warning from clang++
v19 2016-10-03
* Fixed obscure bug when placing an expectation using a value implicitly
convertible to the target type, but not equal comparable with it.
Example:
struct S
{
S(const char* s_) : s(s_) {}
bool operator(const char*) = delete;
bool operator==(const S& rh) const
{
return s == rh.s;
}
std::string s;
};
struct mock {
MAKE_MOCK1(func, void(S));
};
TEST(...)
{
mock m;
REQUIRE_CALL(m, func("string"));
// now compiles and compares the function call parameter value
// with S("string")
}
* Improved compilation error messages for type-mismatch
situations in .RETURN()
v18 2016-08-18
* Writing custom matchers is much simplified through the use
of function template make_matcher<>, which accepts lambdas
for predicate and printing error message.
The old technique of inheriting form trompeloeil::matcher
or trompeloeil::typed_matcher<T> still works.
* Further internal restructuring for yet reduced test program
build time.
v17 2016-06-11
* Use template specialization when writing adapter code for unit
testing frame works.
* Internal restructuring for shorter compilation times.
v16 2016-05-16
* class trompeloeil::lifetime_monitor now inherits from
class trompeloeil::expectation, so using
std::unique_ptr<expectation> p = NAMED_REQUIRE_DESTRUCTION(obj);
instead of
std::unique_ptr<lifetime_monitor> p = NAMED_REQUIRE_DESTRUCTION(obj);
works equally well, reduces the cognitive load a bit, and seems to
build slightly faster.
* .IN_SEQUENCE(...) can now be used with REQUIRE_DESTRUCTION(...)
and NAMED_REQUIRE_DESTRUCTION(...) to ensure objects are
destroyed in the intended order. Example:
auto p1 = new trompeloeil::deathwatched<mock1>;
auto p2 = new trompeloeil::deathwatched<mock2>;
trompeloeil::sequence s;
REQUIRE_DESTRUCTION(*p1)
.IN_SEQUENCE(s);
REQUIRE_DESTRUCTION(*p2)
.IN_SEQUENCE(s);
call_destroyer(p1, p2); // both must be destroyed, p1 before p2.
v15 2016-04-29
* Fixed macro bug that caused warnings with g++ and clang++ when
compiling with strict C++ standards compliance.
v14 2016-04-27
* Fixed bug when the destruction of a sequence object with still
living expectations caused call to abort().
* You can now add extra trailing specifiers to a mock function,
such as the "override" context sensitive specifier, and/or the
keyword "noexcept" (careful with the latter if your registered
reporter can/does throw.)
Example:
struct D : public B {
MAKE_MOCK1(func, int(int), override);
};
v13 2016-03-07
* Mock functions and their expectations are thread safe, using
a global recursive mutex.
* Silenced warnings from g++ -Wshadow.
v12 2016-02-01
* Built in matchers are duck typed by default, i.e. eq, ne, gt, ge,
lt, le do by default match any parameter that supports operators
==, !=, >, >=, <, <= with the value provided. If needed for
disambiguation of overloads an explicit type can be provided. Example:
REQUIRE_CALL(obj, numfunc(gt(3)));
REQUIRE_CALL(obj, strfunc(eq<std::string&>("foo")));
The expectation on numfunc will match a function numfunc with
any parameter type that can be compared as > 3. The expectation on
strfunc will only match an overload with std::string& (if there are
competing overloads, e.g. strfunc(const char*) and
strfunc(const std::string).)
* Fixed a bug with return type deduction where an array type expression
was used. E.g. returning a string literal when the return type was
const char* or std::string caused a compilation error.
* Fixed a bug when the eq(nullptr) matcher actually checked if !=
comparison with nullptr was allowed.
* Reluctantly reverted use of std::tuple_element_t<> for
typename tuple_element<>::type, to support g++ 4.9.0 (4.9.1 does have
std::tuple_element_t<>.)
v11 2016-01-04
* Added regular expression matcher for std::string and c-strings
* Added specialization eq<nullptr> for pointer-like parameters and
pointer-to-member parameters. This is mostly useful for
pointer to pointer parameters, e.g.:
REQUIRE_CALL(obj, func(*trompeloeil::eq(nullptr)));
* Improved accuracy of compilation error message when attempting
to place expectation that does not uniquely match any function
signature.
* Added specialization eq<nullptr> for pointer-like parameters and
v10 2015-12-11
* Fixed bug when wildcard _ could not match std::ostream&
* Fixed ADL bugs
* Added functionality to use the dereference operator (prefix
operator*) on any matcher to instead match a pointer to the
value to check.
* Documented adapter for VisualStudio MSTest
* Corrected documentation bug for how to write report formatting
function trompeloeil::print<>(std::ostream&, T const&).
v9 2015-11-29
* Fixed bug with accepting std::unique_ptr<> by value.
* Signed/unsigned compilation warnings in expectations are attributed
to correct file/line with clang++ and VisualStudio 2015
* Complete documentation overhaul. Now with:
- Cook book
- FAQ
- reference manual
* Better compilation error message when illegal argument is
used in expectation.
* Addressed clang++ and VisualStudio warnings
v8 2015-10-30
* Fixed bug when mock object was destroyed with a saturated
expectation in scope.
* Further improved compilation error messages.
v7 2015-10-24
* Report error if live expectations remain when a mock object is
destroyed
* Reduced clutter in compilation errors
* Allow mock objects to be templates. E.g.
template <typename T>
struct mock
{
MAKE_MOCK1(func, void(T));
};
Note that member function templates are still not supported.
v6 2015-09-22
* Verified support for released Visual Studio 2015
* trompeloeil::ne(nullptr) works for all pointer types
* Fixed a few issues reported by clang 3.7 sanitizers
* line number in reporter_func is unsigned long to match
type of __LINE__
v5 2015-06-19
* Support for Visual Studio 2015 RC
* 5 parameter value matchers are included. These are
(in namespace trompeloeil):
- ne(x) - not equal to x
- lt(x) - less than x
- le(x) - less than or equal to x
- gt(x) - greater than x
- ge(x) - greater than or equal to x
These are used in expectations as e.g.:
REQUIRE_CALL(obj, foo(ne(5)));
which matches calls to foo with a value not equal to 5.
* Support and documentation for how to write custom matchers.
* The function registered to set_reporter() now must accept
the source location as file, line instead of location as
a combined string. Apologies for breaking existing code,
but since this is more in line with how other frame works
refers to source code locations, it improves compatibility.
v4 2015-05-01
* Expectations of death do not follow move-constructed and
copy-constructed deathwatched<T> objects.
* Internal rewrites to reduce compilation times
v3 2015-04-02
* Fixed compiler dependent reference binding SNAFU
v2 2015-04-02
* Improved compilation time performance. 20% drop in compilation time
has been seen in some test programs.
* Improved the compiler's chance to provide good warning messages
when values in expectations don't quite the types used in the
function signature (for example signed/unsigned mismatch.)
* Added support for tracing matching calls. This is an aid when
doing exploratory tests of legacy code. A trace can often
drastically reduce the time required to understand how the legacy
code works.
To use it, create an object of a tracer type, for example:
TEST(atest)
{
trompeloeil::stream_tracer trace(std::cout);
// normal test code
}
v1 2015-01-10
First official release.