mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added documentation in the limitations section about why non-virtual methods cannot be mocked
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@693 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
7c3714169d
commit
f77cac0103
2 changed files with 36 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
[section Limitations]
|
||||
[import example/limitations_literal_zero.cpp]
|
||||
[import example/limitations_throw_specifier.cpp]
|
||||
[import example/limitations_non_virtual_method.cpp]
|
||||
[import example/limitations_template_method.cpp]
|
||||
[import example/limitations_private_method.cpp]
|
||||
[import example/limitations_comma_in_macro.cpp]
|
||||
|
|
@ -59,6 +60,22 @@ While still somewhat possible, mocking a template method is indeed a bit cumbers
|
|||
|
||||
[endsect]
|
||||
|
||||
[section Non-virtual methods cannot be mocked]
|
||||
|
||||
Given :
|
||||
|
||||
[limitations_non_virtual_method_problem]
|
||||
|
||||
the following code compiles but will not work as expected :
|
||||
|
||||
[limitations_non_virtual_method_problem_2]
|
||||
|
||||
The mock object will never be exercised because the library relies on polymorphism to hook the calls.
|
||||
|
||||
There is no other solution than to refactor the production code, the most simple being to change the method to virtual.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Private virtual methods cannot be mocked without spelling out the signature]
|
||||
|
||||
Given :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue