Let toplevel links to .md files link to .md#top

This commit is contained in:
Martin Moene 2017-08-24 15:33:38 +02:00 committed by Martin Hořeňovský
parent e8225052f1
commit 6c09b45a20
21 changed files with 61 additions and 61 deletions

View File

@ -18,11 +18,11 @@ extensions may require additional headers.
## How to use it
This documentation comprises these three parts:
* [Why do we need yet another C++ Test Framework?](docs/why-catch.md)
* [Tutorial](docs/tutorial.md) - getting started
* [Reference section](docs/Readme.md) - all the details
* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top)
* [Tutorial](docs/tutorial.md#top) - getting started
* [Reference section](docs/Readme.md#top) - all the details
## More
* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/philsquared/Catch/issues)
* For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum)
* See [who else is using Catch](docs/opensource-users.md)
* See [who else is using Catch](docs/opensource-users.md#top)

View File

@ -1,31 +1,31 @@
<a id="top"></a>
To get the most out of Catch, start with the [tutorial](tutorial.md).
To get the most out of Catch, start with the [tutorial](tutorial.md#top).
Once you're up and running consider the following reference material.
Writing tests:
* [Assertion macros](assertions.md)
* [Matchers](matchers.md)
* [Logging macros](logging.md)
* [Test cases and sections](test-cases-and-sections.md)
* [Test fixtures](test-fixtures.md)
* [Reporters](reporters.md)
* [Event Listeners](event-listeners.md)
* [Assertion macros](assertions.md#top)
* [Matchers](matchers.md#top)
* [Logging macros](logging.md#top)
* [Test cases and sections](test-cases-and-sections.md#top)
* [Test fixtures](test-fixtures.md#top)
* [Reporters](reporters.md#top)
* [Event Listeners](event-listeners.md#top)
Fine tuning:
* [Supplying your own main()](own-main.md)
* [Compile-time configuration](configuration.md)
* [String Conversions](tostring.md)
* [Supplying your own main()](own-main.md#top)
* [Compile-time configuration](configuration.md#top)
* [String Conversions](tostring.md#top)
Running:
* [Command line](command-line.md)
* [CI and Build system integration](build-systems.md)
* [Command line](command-line.md#top)
* [CI and Build system integration](build-systems.md#top)
FAQ:
* [Why are my tests slow to compile?](slow-compiles.md)
* [Known limitations](limitations.md)
* [Why are my tests slow to compile?](slow-compiles.md#top)
* [Known limitations](limitations.md#top)
Other:
* [Why Catch?](why-catch.md)
* [Open Source Projects using Catch](opensource-users.md)
* [Contributing](contributing.md)
* [Release Notes](release-notes.md)
* [Why Catch?](why-catch.md#top)
* [Open Source Projects using Catch](opensource-users.md#top)
* [Contributing](contributing.md#top)
* [Release Notes](release-notes.md#top)

View File

@ -132,7 +132,7 @@ REQUIRE_NOTHROW([&](){
## Matcher expressions
To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md).
To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md#top).
* **REQUIRE_THAT(** _lhs_, _matcher expression_ **)** and
* **CHECK_THAT(** _lhs_, _matcher expression_ **)**
@ -146,4 +146,4 @@ For more details, along with workarounds, see the section on [the limitations pa
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -141,4 +141,4 @@ If you are using GCOV tool to get testing coverage of your code, and are not sur
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -299,4 +299,4 @@ So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be t
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -1,7 +1,7 @@
<a id="top"></a>
# Commercial users of Catch
As well as [Open Source](opensource-users.md) users Catch is widely used within proprietary code bases too.
As well as [Open Source](opensource-users.md#top) users Catch is widely used within proprietary code bases too.
Many organisations like to keep this information internal, and that's fine,
but if you're more open it would be great if we could list the names of as
many organisations as possible that use Catch somewhere in their codebase.

View File

@ -102,4 +102,4 @@ On Windows Catch includes `windows.h`. To minimize global namespace clutter in t
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -58,4 +58,4 @@ be fairly self-explanatory.
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -72,4 +72,4 @@ just look in the source code to see what fields are available.
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -80,4 +80,4 @@ These macros are now deprecated and are just aliases for INFO and CAPTURE (which
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -102,4 +102,4 @@ with expansion:
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -84,4 +84,4 @@ Standardese aims to be a nextgen Doxygen
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -84,4 +84,4 @@ Catch embeds a powerful command line parser which you can also use to parse your
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -153,7 +153,7 @@
* This means it reports `INFO` messages on success, if output on success (`-s`) is enabled.
* Previously it only reported `INFO` messages on failure.
* `CAPTURE(expr)` now stringifies `expr` in the same way assertion macros do (#639)
* Listeners are now finally [documented](event-listeners.md).
* Listeners are now finally [documented](event-listeners.md#top).
* Listeners provide a way to hook into events generated by running your tests, including start and end of run, every test case, every section and every assertion.
@ -192,7 +192,7 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough
* Matchers have new, simpler (and documented) interface.
* Catch provides string and vector matchers.
* For details see [Matchers documentation](matchers.md).
* For details see [Matchers documentation](matchers.md#top).
* Changed console reporter test duration reporting format (#322)
* Old format: `Some simple comparisons between doubles completed in 0.000123s`
* New format: `xxx.123s: Some simple comparisons between doubles` _(There will always be exactly 3 decimal places)_
@ -203,10 +203,10 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough
* _More changes are coming_
* Added [TAP (Test Anything Protocol)](https://testanything.org/) and [Automake](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) reporters.
* These are not present in the default single-include header and need to be downloaded from GitHub separately.
* For details see [documentation about integrating with build systems](build-systems.md).
* For details see [documentation about integrating with build systems](build-systems.md#top).
* XML reporter now reports filename as part of the `Section` and `TestCase` tags.
* `Approx` now supports an optional margin of absolute error
* It has also received [new documentation](assertions.md).
* It has also received [new documentation](assertions.md#top).
### Fixes
* Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer.
@ -249,7 +249,7 @@ Other:
### Fixes:
* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
* For specifics, look into the [documentation](configuration.md).
* For specifics, look into the [documentation](configuration.md#top).
* Fixed compilation error under MinGW caused by improper compiler detection.
* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
* Fixed XML reporter not reporting captured stdout/stderr.
@ -263,7 +263,7 @@ Other:
* Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s.
* Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s.
* Catch can now run specific sections within test cases.
* For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md).
* For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md#top).
* Catch now supports SEH on Windows as well as signals on Linux.
* After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler.
* Approx can be used to compare values against strong typedefs (available in C++11 mode only).
@ -300,7 +300,7 @@ Other:
* Approval tests can now be run on Windows
* CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project
* Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h`
* This can be disabled if needed, see [documentation](configuration.md) for details.
* This can be disabled if needed, see [documentation](configuration.md#top) for details.
## 1.6.0
@ -329,4 +329,4 @@ Release notes were not maintained prior to v1.6.0, but you should be able to wor
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -43,4 +43,4 @@ but do keep in mind upcoming changes (these will be minor, simplifying, changes
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -19,7 +19,7 @@ Because Catch is implemented *entirely* in headers you might think that the whol
As a result the main source file *does* compile the whole of Catch every time! So it makes sense to dedicate this file to *only* ```#define```-ing the identifier and ```#include```-ing Catch (and implementing the runner code, if you're doing that). Keep all your test cases in other files. This way you won't pay the recompilation cost for the whole of Catch
## Practical example
Assume you have the `Factorial` function from the [tutorial](tutorial.md) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`:
Assume you have the `Factorial` function from the [tutorial](tutorial.md#top) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`:
```cpp
// tests-main.cpp
@ -62,4 +62,4 @@ You can also opt to sacrifice some features in order to speed-up Catch's compila
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -12,7 +12,7 @@ Test cases and sections are very easy to use in practice:
_test name_ and _section name_ are free form, quoted, strings. The optional _tags_ argument is a quoted string containing one or more tags enclosed in square brackets. Tags are discussed below. Test names must be unique within the Catch executable.
For examples see the [Tutorial](tutorial.md)
For examples see the [Tutorial](tutorial.md#top)
## Tags
@ -86,4 +86,4 @@ Other than the additional prefixes and the formatting in the console reporter th
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -30,4 +30,4 @@ The two test cases here will create uniquely-named derived classes of UniqueTest
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -45,4 +45,4 @@ CATCH_TRANSLATE_EXCEPTION( MyType& ex ) {
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -40,7 +40,7 @@ TEST_CASE( "Factorials are computed", "[factorial]" ) {
}
```
This will compile to a complete executable which responds to [command line arguments](command-line.md). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work").
This will compile to a complete executable which responds to [command line arguments](command-line.md#top). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work").
If you run this as written it will pass. Everything is good. Right?
Well, there is still a bug here. In fact the first version of this tutorial I posted here genuinely had the bug in! So it's not completely contrived (thanks to Daryle Walker (```@CTMacUser```) for pointing this out).
@ -87,8 +87,8 @@ Of course there are still more issues to deal with. For example we'll hit proble
Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take moment to consider those before we move on.
1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md)).
2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests.
1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md#top). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md#top)).
2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md#top) for more information on running tests.
3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names.
4. We write our individual test assertions using the ```REQUIRE``` macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced.
@ -162,7 +162,7 @@ Sections can be nested to an arbitrary depth (limited only by your stack size).
## BDD-Style
If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md).
If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md#top).
The vector example can be adjusted to use these macros like so:
@ -225,7 +225,7 @@ Scenario: vectors can be sized and resized
To keep the tutorial simple we put all our code in a single file. This is fine to get started - and makes jumping into Catch even quicker and easier. As you write more real-world tests, though, this is not really the best approach.
The requirement is that the following block of code ([or equivalent](own-main.md)):
The requirement is that the following block of code ([or equivalent](own-main.md#top)):
```c++
#define CATCH_CONFIG_MAIN
@ -234,7 +234,7 @@ The requirement is that the following block of code ([or equivalent](own-main.md
appears in _exactly one_ source file. Use as many additional cpp files (or whatever you call your implementation files) as you need for your tests, partitioned however makes most sense for your way of working. Each additional file need only ```#include "catch.hpp"``` - do not repeat the ```#define```!
In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md).
In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md#top).
Do not write your tests in header files!
@ -243,8 +243,8 @@ Do not write your tests in header files!
This has been a brief introduction to get you up and running with Catch, and to point out some of the key differences between Catch and other frameworks you may already be familiar with. This will get you going quite far already and you are now in a position to dive in and write some tests.
Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md) for what's available.
Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md#top) for what's available.
---
[Home](Readme.md)
[Home](Readme.md#top)

View File

@ -37,10 +37,10 @@ So what does Catch bring to the party that differentiates it from these? Apart f
## Who else is using Catch?
See the list of [open source projects using Catch](opensource-users.md).
See the list of [open source projects using Catch](opensource-users.md#top).
See the [tutorial](tutorial.md) to get more of a taste of using Catch in practice
See the [tutorial](tutorial.md#top) to get more of a taste of using Catch in practice
---
[Home](Readme.md)
[Home](Readme.md#top)