diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:55 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:55 +0100 |
commit | 062cd07342edc2b003555e90dd2cee0514b9f64a (patch) | |
tree | 3c73893dae8a9380c9f24e9c5822c5ec6bf671d5 /vendor/bandit/specs/context.spec.cpp | |
parent | ffee481435ac0afe3f9a5a3eb07b2f2a46467089 (diff) |
Add BanditCpp 1.1.4 test harness
Diffstat (limited to 'vendor/bandit/specs/context.spec.cpp')
-rw-r--r-- | vendor/bandit/specs/context.spec.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/bandit/specs/context.spec.cpp b/vendor/bandit/specs/context.spec.cpp new file mode 100644 index 00000000..d517ef80 --- /dev/null +++ b/vendor/bandit/specs/context.spec.cpp @@ -0,0 +1,44 @@ +#include <specs/specs.h> + +go_bandit([](){ + + describe("bandit_context:", [&](){ + + std::unique_ptr<bandit::detail::bandit_context> context; + + before_each([&](){ + bool hard_skip = false; + context = std::unique_ptr<bandit::detail::bandit_context>( + new bandit::detail::bandit_context("context name", hard_skip)); + }); + + it("is ok to register before_each as it is not executing", [&](){ + context->register_before_each([](){}); + }); + + it("is ok to register after_each as it is not executing", [&](){ + context->register_after_each([](){}); + }); + + describe("is executing", [&](){ + + before_each([&](){ + context->execution_is_starting(); + }); + + it("is not ok to register before_each", [&](){ + AssertThrows(bandit::detail::test_run_error, context->register_before_each([](){})); + Assert::That(LastException<bandit::detail::test_run_error>().what(), + Equals("before_each was called after 'describe' or 'it'")); + }); + + it("is not ok to register after_each", [&](){ + AssertThrows(bandit::detail::test_run_error, context->register_after_each([](){})); + Assert::That(LastException<bandit::detail::test_run_error>().what(), + Equals("after_each was called after 'describe' or 'it'")); + }); + }); + + }); + +}); |