@@ -15,12 +15,14 @@ */ #include "config.h" #import "OFSet.h" -#import "OFAutoreleasePool.h" #import "OFArray.h" +#import "OFAutoreleasePool.h" + +#import "OFEnumerationMutationException.h" #import "TestsAppDelegate.h" static OFString *module = @"OFSet"; @@ -104,10 +106,21 @@ if (i != 4) ok = NO; TEST(@"Fast enumeration", ok) + + ok = NO; + @try { + for (OFString *s in mutableSet) + [mutableSet removeObject: s]; + } @catch (OFEnumerationMutationException *e) { + ok = YES; + [e dealloc]; + } + + TEST(@"Detection of mutation during Fast Enumeration", ok); #endif [pool drain]; } @end