diff options
author | onqtam <vik.kirilov@gmail.com> | 2018-10-24 17:46:32 +0300 |
---|---|---|
committer | onqtam <vik.kirilov@gmail.com> | 2018-10-24 17:46:32 +0300 |
commit | 9639cee39840d60e5dc175233b6e5f9ec71e3a61 (patch) | |
tree | 058f88786542b10a1b4c8c111bfd5b0d2648133c | |
parent | dc011983010b2be7975aa91192bbcbd70b01bdd9 (diff) |
version 2.0.1
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | doc/html_generated/faq.html | 1 | ||||
-rw-r--r-- | doc/html_generated/readme.html | 1 | ||||
-rw-r--r-- | doc/html_generated/reporters.html | 55 | ||||
-rw-r--r-- | doctest/doctest.h | 4 | ||||
-rw-r--r-- | doctest/parts/doctest_fwd.h | 4 | ||||
-rw-r--r-- | examples/all_features/test_output/version.txt | 2 | ||||
-rw-r--r-- | scripts/version.txt | 2 |
8 files changed, 60 insertions, 11 deletions
@@ -83,7 +83,7 @@ The framework can be used like any other if you don't want/need to mix productio [![download](https://img.shields.io/badge/download%20%20-latest-blue.svg)](https://raw.githubusercontent.com/onqtam/doctest/master/doctest/doctest.h) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/503/badge)](https://bestpractices.coreinfrastructure.org/projects/503) [![Join the chat at https://gitter.im/onqtam/doctest](https://badges.gitter.im/onqtam/doctest.svg)](https://gitter.im/onqtam/doctest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](https://wandbox.org/permlink/PtVvXuY705tH6MvO) +[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](https://wandbox.org/permlink/QKep7PVGli9XFaff) <!-- [![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/) [![documentation](https://img.shields.io/badge/documentation%20%20-online-blue.svg)](https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference) diff --git a/doc/html_generated/faq.html b/doc/html_generated/faq.html index 996f7e86..16d691e9 100644 --- a/doc/html_generated/faq.html +++ b/doc/html_generated/faq.html @@ -35,6 +35,7 @@ Aside from everything mentioned so far doctest has some [**features**](features. Missing stuff: +- xml reporter - matchers and generators - other small stuff diff --git a/doc/html_generated/readme.html b/doc/html_generated/readme.html index a1c7fd9a..69ec5bee 100644 --- a/doc/html_generated/readme.html +++ b/doc/html_generated/readme.html @@ -25,6 +25,7 @@ Usage: - [```main()``` entry point](main.html) - [Configuration](configuration.html) - [String conversions](stringification.html) +- [Reporters](reporters.html) - [FAQ](faq.html) - [Build systems](build-systems.html) - [Examples](../../examples) diff --git a/doc/html_generated/reporters.html b/doc/html_generated/reporters.html index 255fcbf4..e1216cbe 100644 --- a/doc/html_generated/reporters.html +++ b/doc/html_generated/reporters.html @@ -5,12 +5,59 @@ ## Reporters -TODO: document me! +A very sloppy documentation of the partial reporters support. + +Example how to define your own reporter: + +``` +using namespace doctest; + +struct XmlReporter : public IReporter +{ + std::ostream& s; + std::vector<SubcaseSignature> subcasesStack; + + // caching pointers to objects of these types - safe to do + const ContextOptions* opt; + const TestCaseData* tc; + + XmlReporter(std::ostream& in) + : s(in) {} + + void test_run_start(const ContextOptions& o) override { opt = &o; } + + void test_run_end(const TestRunStats& /*p*/) override {} + + void test_case_start(const TestCaseData& in) override { tc = ∈ } + + void test_case_end(const CurrentTestCaseStats& /*st*/) override {} + + void subcase_start(const SubcaseSignature& subc) override { subcasesStack.push_back(subc); } + + void subcase_end(const SubcaseSignature& /*subc*/) override { subcasesStack.pop_back(); } + + void log_assert(const AssertData& /*rb*/) override {} + + void log_message(const MessageData& /*mb*/) override {} + + void test_case_skipped(const TestCaseData& /*in*/) override {} +}; + +XmlReporter r(std::cout); +DOCTEST_REGISTER_REPORTER("xml", 1, r); +``` + +Multiple reporters can be used at the same time - just specify them through the ```--reporters=...``` [**command line option**](commandline.html). The number ```1``` in this case is the priority - reporters will be called in the order defined by their priority when a few of them are selected to be used at the same time. + +You can list all registered reporters with ```--list-reporters```. There is only 1 implemented reporter in the framework - a console reporter - an xml one is coming in the next version. the reporter interface can also be used for "listening" to events. + +Reporters will be fully implemented and more thoroughly documented (with examples) for version 2.1 - [**roadmap**](roadmap.html). TODO: think about: -- add an "assertion starting" event/callback? -- people having to handle locking on their own in the reporters... - - or log_assert() can be called for reporters (so also for listeners) only when failed or when also printing on success! + +- people having to handle locking on their own in the reporters - just like currently in the console reporter... + - or log_assert() can be called for reporters (so also for listeners) only when failed or when printing on success! + - or it could be a 'policy' for the reporter --------------- diff --git a/doctest/doctest.h b/doctest/doctest.h index 7f49e51c..9d3304ff 100644 --- a/doctest/doctest.h +++ b/doctest/doctest.h @@ -47,8 +47,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 0 -#define DOCTEST_VERSION_PATCH 0 -#define DOCTEST_VERSION_STR "2.0.0" +#define DOCTEST_VERSION_PATCH 1 +#define DOCTEST_VERSION_STR "2.0.1" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h index 0970a410..8768b6d7 100644 --- a/doctest/parts/doctest_fwd.h +++ b/doctest/parts/doctest_fwd.h @@ -44,8 +44,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 0 -#define DOCTEST_VERSION_PATCH 0 -#define DOCTEST_VERSION_STR "2.0.0" +#define DOCTEST_VERSION_PATCH 1 +#define DOCTEST_VERSION_STR "2.0.1" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) diff --git a/examples/all_features/test_output/version.txt b/examples/all_features/test_output/version.txt index ccf15a19..fb775db2 100644 --- a/examples/all_features/test_output/version.txt +++ b/examples/all_features/test_output/version.txt @@ -1 +1 @@ -[doctest] doctest version is "2.0.0" +[doctest] doctest version is "2.0.1" diff --git a/scripts/version.txt b/scripts/version.txt index 359a5b95..10bf840e 100644 --- a/scripts/version.txt +++ b/scripts/version.txt @@ -1 +1 @@ -2.0.0
\ No newline at end of file +2.0.1
\ No newline at end of file |