summaryrefslogtreecommitdiff
path: root/vendor/bandit/specs/synopsis.spec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/bandit/specs/synopsis.spec.cpp')
-rw-r--r--vendor/bandit/specs/synopsis.spec.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/vendor/bandit/specs/synopsis.spec.cpp b/vendor/bandit/specs/synopsis.spec.cpp
new file mode 100644
index 00000000..3b717f75
--- /dev/null
+++ b/vendor/bandit/specs/synopsis.spec.cpp
@@ -0,0 +1,54 @@
+#include <specs/specs.h>
+
+go_bandit([](){
+ describe("my first spec", [&]() {
+ int a;
+
+ before_each([&](){
+ a = 99;
+ });
+
+ it("should be initialized", [&](){
+ AssertThat(a, Equals(99));
+ a = 102;
+ });
+
+ describe("nested spec", [&](){
+
+ before_each([&](){
+ a += 3;
+ });
+
+ it("should build on outer spec", [&](){
+ AssertThat(a, Equals(102));
+ a = 666;
+ });
+
+ it("should build on outer spec yet again", [&](){
+ AssertThat(a, Equals(102));
+ a = 667;
+ });
+
+ });
+
+ it("should be initialized before each it", [&](){
+ AssertThat(a, Equals(99));
+ });
+ });
+
+ describe("my second spec", [&](){
+ int b;
+
+ before_each([&](){
+ b = 22;
+ });
+
+ before_each([&](){
+ b += 3;
+ });
+
+ it("should be 25", [&](){
+ AssertThat(b, Equals(25));
+ });
+ });
+});