@@ -16,10 +16,11 @@ #include "config.h" #import "OFThread.h" #import "OFString.h" +#import "OFDictionary.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" static OFString *module = @"OFThread"; @@ -28,36 +29,31 @@ @end @implementation TestThread - (id)main { + [[OFThread threadDictionary] setObject: @"bar" + forKey: @"foo"]; + return @"success"; } @end @implementation TestsAppDelegate (OFThreadTests) - (void)threadTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; TestThread *t; - OFTLSKey *key; + OFMutableDictionary *d; TEST(@"+[thread]", (t = [TestThread thread])) TEST(@"-[start]", R([t start])) TEST(@"-[join]", [[t join] isEqual: @"success"]) - TEST(@"OFTLSKey's +[TLSKey]", (key = [OFTLSKey TLSKey])) - - TEST(@"+[setObject:forTLSKey:]", - R([OFThread setObject: @"setme" - forTLSKey: key]) && - R([OFThread setObject: @"foo" - forTLSKey: key])) - - TEST(@"+[objectForTLSKey:]", - [[OFThread objectForTLSKey: key] isEqual: @"foo"]) + TEST(@"-[threadDictionary]", (d = [OFThread threadDictionary]) && + [d objectForKey: @"foo"] == nil) [pool drain]; } @end