Skip to content

Commit 36e3b19

Browse files
committed
Merge pull request #27 from martinmoene/typo-manual
Apply several small changes to the Core Manual
2 parents d3c8fb7 + f1c6f7c commit 36e3b19

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

manual.markdown

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ The failure of one of these macros causes the current test to immediately exit:
150150

151151
*CHECK_EQUAL Warning:*
152152

153-
CHECK_EQUAL(expected, actual) can produce misleading error reports as it will evaluate expected and actual more than ones. This especially leads to confusions when used with mocks. This happens if the mock function expects to be called exactly once, since the macro needs to evaluate the actual expression more than once. The problem does not occur with type specific checks (e.g. LONGS_EQUAL()), so it is recommended to use them if possible. Instead of:
153+
CHECK_EQUAL(expected, actual) can produce misleading error reports as it will evaluate expected and actual more than once. This especially leads to confusions when used with mocks. This happens if the mock function expects to be called exactly once, since the macro needs to evaluate the actual expression more than once. The problem does not occur with type specific checks (e.g. LONGS_EQUAL()), so it is recommended to use them if possible. Instead of:
154154

155155
{% highlight c++ %}
156156
CHECK_EQUAL(10, mock_returning_11())
@@ -306,10 +306,10 @@ If you want to completely disable memory leak detection then you can do so by bu
306306

307307
### Conflicts with operator new macros (STL!)
308308

309-
It is common for the memory leak detection macros to conflict with an overloaded operator new or with STL. This is because the macro replaces the call to operator new to a call to operator new with __FILE__, and __LINE__. If you overload operator new, it will replace your overloaded definition resulting in a compiler error. This is common when using Standard C++ library (STL).
309+
It is common for the memory leak detection macros to conflict with an overloaded operator new or with STL. This is because the macro replaces the call to operator new to a call to operator new with __FILE__, and __LINE__. If you overload operator new, it will replace your overloaded definition resulting in a compiler error. This is common when using the Standard C++ library (STL).
310310

311311
#### Resolving conflicts with STL
312-
The easiest way is not to pass the --include MemoryLeakDetectionNewMacros.h to the compiler, but this would lose all your file and line information. So this is not recommended. An alternative is to create your own NewMacros.h file which will include the STL file *before* the new macro is defined. For example, the following NewMacros file can be used for a program that uses std::list:
312+
The easiest way is to not pass the --include MemoryLeakDetectionNewMacros.h to the compiler, but this would lose all your file and line information. So this is not recommended. An alternative is to create your own NewMacros.h file which will include the STL file *before* the new macro is defined. For example, the following NewMacros file can be used for a program that uses std::list:
313313

314314
{% highlight c++ %}
315315
#include "list"
@@ -320,7 +320,7 @@ Now the call to the compiler needs to be -include MyOwnNewMacros.h and this will
320320

321321
### Conflicts with my own overload!
322322

323-
This one is harder (and luckily less common). You can solve this the same way as the conflict in STL, but it's probably better to use a finer grained control. So, instead you can temporary disable the new macros, overload operator new, enable the new macro again. This can be done with the following code:
323+
This one is harder (and luckily less common). You can solve this the same way as the conflict with the STL, but it's probably better to use a finer grained control. So, instead you can temporary disable the new macros, overload operator new, enable the new macro again. This can be done with the following code:
324324

325325
{% highlight c++ %}
326326
class NewDummyClass
@@ -349,7 +349,7 @@ Tbd
349349

350350
## Test Plugins
351351

352-
Test plugins let you add a preaction and a post action to each test case. Plugin examples:
352+
Test plugins let you add a pre-action and a post-action to each test case. Plugin examples:
353353

354354
* Memory leak detector (provided)
355355
* Pointer restore mechanism (provided) - helpful when tests overwrite a pointer that must be restored to its original value after the test. This is especially helpful when a pointer to a function is modified for test purposes.
@@ -425,8 +425,8 @@ void printHelloWorld()
425425

426426
## Scripts
427427

428-
There are some scripts that are helpful in creating your initial h, source, and
429-
Test files. These save a lot of typing. See scripts/README.TXT from the CppUTest distribution.
428+
There are some scripts that are helpful in creating your initial header, source, and
429+
Test files. These scripts save a lot of typing. See scripts/README.TXT from the CppUTest distribution.
430430

431431
<a id="advanced"> </a>
432432

@@ -448,7 +448,7 @@ The Extensions directory has a few of these.
448448
* TestPlugins can be used for, for example, system stability and resource handling like files, memory or network connection clean-up.
449449
* In CppUTest, the memory leak detection is done via a default enabled TestPlugin
450450

451-
### How can tests run when they are linked in a library
451+
### How to run tests when they are linked in a library
452452

453453
In larger projects, it is often useful if you can link the tests in "libraries of tests" and then link them to the library of a component or link them all together to be able to run all the unit tests. Putting the tests in a library however causes an interesting problem because the lack of reference to the tests (due to the auto-registration of tests) causes the linker to discard the tests and it won't run any of them. There are two different work-arounds for this:
454454

0 commit comments

Comments
 (0)