Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -20,10 +20,22 @@ AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"]) AX_CHECK_COMPILER_FLAGS(-fno-constant-cfstrings, [ NO_CONST_CFSTRINGS="-fno-constant-cfstrings" OBJCFLAGS="$OBJCFLAGS -fno-constant-cfstrings"]) AC_SUBST(NO_CONST_CFSTRINGS) + +AC_MSG_CHECKING(whether Objective C compiler supports fast enumeration) +AC_TRY_COMPILE([ + #import + ], [ + id n = nil; + for (id i in n); + ], [ + AC_DEFINE(OF_HAVE_FAST_ENUMERATION, 1, [Fast Enumeration support]) + AC_MSG_RESULT(yes) + ], [ + AC_MSG_RESULT(no)]) AC_MSG_CHECKING(which Objective C runtime we use) dnl TODO: This is ugly. Let's think of a better check. AC_EGREP_CPP(gnu, [ #import @@ -143,11 +155,12 @@ #include #include #else #define _WIN32_WINNT 0x0501 #include - #endif], [ + #endif + ], [ struct addrinfo ai; getaddrinfo(NULL, NULL, NULL, NULL); ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether we have getaddrinfo]) Index: tests/OFArray.m ================================================================== --- tests/OFArray.m +++ tests/OFArray.m @@ -63,10 +63,23 @@ TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1) TEST(@"-[indexOfObjectIdenticalTo:]", [a[0] indexOfObjectIdenticalTo: c_ary[1]] == 1) + +#ifdef OF_HAVE_FAST_ENUMERATION + size_t i = 0; + BOOL ok = YES; + + for (OFString *s in a[0]) { + if (![s isEqual: c_ary[i]]) + ok = NO; + i++; + } + + TEST(@"Fast Enumeration", ok) +#endif TEST(@"-[replaceObject:withObject:]", [a[0] replaceObject: c_ary[1] withObject: c_ary[0]] && [[a[0] objectAtIndex: 0] isEqual: c_ary[0]] &&