Add test for +initialize being called whether or not it's implemented.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33844 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-09-16 08:33:05 +00:00
parent 6094a0cfa6
commit f9d6895627

View file

@ -3,6 +3,12 @@
#include <unistd.h>
#import "Testing.h"
@interface Init0 : NSObject
@end
@interface Init1 : Init0
@end
@interface SlowInit0
@end
@ -16,6 +22,17 @@
static NSCondition *l;
static volatile int init0, init1, init2, init3;
static int initCount = 0;
@implementation Init0
+ (void) initialize
{
initCount++;
}
@end
@implementation Init1
@end
@implementation SlowInit0
+ (void) initialize
@ -115,6 +132,12 @@ int main(void)
*/
PASS(1, "initialize test starts");
/* Make sure that when a class without its own +initialise is first used,
* the inherited +initialize is called instead.
*/
[Init1 class];
PASS(2 == initCount, "inherited +initialize is called automatically");
#if defined(SIGALRM)
/* End in a signal if the concurrency test deadlocks.
*/