@@ -17,10 +17,11 @@ #include "config.h" #import "OFINIFile.h" #import "OFINICategory.h" #import "OFString.h" +#import "OFArray.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" @@ -51,13 +52,16 @@ NL @"[types]" NL @"integer=16" NL @"bool=false" NL @"float=0.25" NL + @"array1=foo" NL + @"array1=bar" NL @"double=0.75" NL; OFINIFile *file; OFINICategory *tests, *foobar, *types; + OFArray *array; TEST(@"+[fileWithPath:encoding:]", (file = [OFINIFile fileWithPath: @"testfile.ini" encoding: OF_STRING_ENCODING_CODEPAGE_437])) @@ -106,13 +110,24 @@ [types doubleForKey: @"double" defaultValue: 3] == 0.25) TEST(@"-[setDouble:forKey:]", R([types setDouble: 0.75 forKey: @"double"])) + + array = [OFArray arrayWithObjects: @"1", @"2", nil]; + TEST(@"-[arrayForKey:]", + [[types arrayForKey: @"array1"] isEqual: array] && + [[types arrayForKey: @"array2"] isEqual: array] && + [[types arrayForKey: @"array3"] isEqual: [OFArray array]]) + + array = [OFArray arrayWithObjects: @"foo", @"bar", nil]; + TEST(@"-[setArray:forKey:]", R([types setArray: array + forKey: @"array1"])) TEST(@"-[removeValueForKey:]", - R([foobar removeValueForKey: @"quxqux "])) + R([foobar removeValueForKey: @"quxqux "]) && + R([types removeValueForKey: @"array2"])) module = @"OFINIFile"; /* FIXME: Find a way to write files on Nintendo DS */ #ifndef OF_NINTENDO_DS