blob: 3b717f75d6594c54a99b9ff8b21e6d99234a1220 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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));
});
});
});
|