]> git.saurik.com Git - apple/objc4.git/blob - test/badPool.m
objc4-781.tar.gz
[apple/objc4.git] / test / badPool.m
1 // TEST_CONFIG MEM=mrc
2 // TEST_CRASHES
3
4 // Test badPoolCompat also uses this file.
5
6 /*
7 TEST_RUN_OUTPUT
8 objc\[\d+\]: [Ii]nvalid or prematurely-freed autorelease pool 0x[0-9a-fA-F]+\.?
9 objc\[\d+\]: HALTED
10 END
11 */
12
13 #include "test.h"
14
15 int main()
16 {
17 void *outer = objc_autoreleasePoolPush();
18 void *inner = objc_autoreleasePoolPush();
19 objc_autoreleasePoolPop(outer);
20 objc_autoreleasePoolPop(inner);
21
22 #if !OLD
23 fail("should have crashed already with new SDK");
24 #else
25 // should only warn once
26 outer = objc_autoreleasePoolPush();
27 inner = objc_autoreleasePoolPush();
28 objc_autoreleasePoolPop(outer);
29 objc_autoreleasePoolPop(inner);
30
31 succeed(__FILE__);
32 #endif
33 }
34