]>
Commit | Line | Data |
---|---|---|
b061a43b A |
1 | #include <Block.h> |
2 | #include <darwintest.h> | |
3 | #include <err.h> | |
4 | ||
5 | #define ITERATIONS 100 | |
6 | ||
7 | T_DECL(err_multiple_exit_b, "Repeated set exit blocks doesn't leak copied blocks") | |
8 | { | |
9 | int __block num = 0; | |
10 | for (int i = 0; i < ITERATIONS; ++i) { | |
11 | err_set_exit_b(^(int j) { num += j; }); | |
12 | } | |
13 | err_set_exit_b(NULL); | |
14 | // Dummy expect is necessary to run leaks on this test. | |
15 | T_EXPECT_NULL(NULL, "DUMMY EXPECT"); | |
16 | } | |
17 | ||
18 | T_DECL(err_multiple_exit, "Setting exit w/o block after setting exit with block doesn't leak copied block") | |
19 | { | |
20 | int __block num = 0; | |
21 | err_set_exit_b(^(int j) { num += j; }); | |
22 | err_set_exit(NULL); | |
23 | // Dummy expect is necessary to run leaks on this test. | |
24 | T_EXPECT_NULL(NULL, "DUMMY EXPECT"); | |
25 | } |