ObjFW  Check-in [7561b9244e]

Overview
Comment:OFStringTests: Fix a path test on Win32.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7561b9244e0b4d15445cb4c52cb5b8ae7d78220474eeadbaced0175a7b995b07
User & Date: js on 2013-10-30 00:09:39
Other Links: manifest | tags
Context
2013-10-30
17:06
OFZIPArchive: Return entries in a sorted array. check-in: 95f6035588 user: js tags: trunk
00:09
OFStringTests: Fix a path test on Win32. check-in: 7561b9244e user: js tags: trunk
2013-10-29
23:46
Clean up OF_ENSURE() vs. assert() a little. check-in: a427cfc86a user: js tags: trunk
Changes

Modified src/OFString.m from [afe2a7a5d7] to [c9aea4c452].

166
167
168
169
170
171
172
173

174
175
176
177
178
179
180
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180







-
+







	while (*string++ != 0)
		length++;

	return length;
}

static OFString*
standardize_path(OFArray *components, OFString *currentDirectory,
standardizePath(OFArray *components, OFString *currentDirectory,
    OFString *parentDirectory, OFString *joinString)
{
	void *pool = objc_autoreleasePoolPush();
	OFMutableArray *array;
	OFString *ret;
	bool done = false, startsWithEmpty, endsWithEmpty;

2195
2196
2197
2198
2199
2200
2201
2202

2203
2204
2205
2206
2207
2208
2209

2210
2211
2212
2213
2214
2215
2216
2195
2196
2197
2198
2199
2200
2201

2202
2203
2204
2205
2206
2207
2208

2209
2210
2211
2212
2213
2214
2215
2216







-
+






-
+







	[ret retain];
	objc_autoreleasePoolPop(pool);
	return [ret autorelease];
}

- (OFString*)stringByStandardizingPath
{
	return standardize_path([self pathComponents],
	return standardizePath([self pathComponents],
	    OF_PATH_CURRENT_DIRECTORY, OF_PATH_PARENT_DIRECTORY,
	    OF_PATH_DELIMITER_STRING);
}

- (OFString*)stringByStandardizingURLPath
{
	return standardize_path( [self componentsSeparatedByString: @"/"],
	return standardizePath([self componentsSeparatedByString: @"/"],
	    @".", @"..", @"/");
}

- (intmax_t)decimalValue
{
	void *pool = objc_autoreleasePoolPush();
	const of_unichar_t *characters = [self characters];

Modified tests/OFStringTests.m from [3c7c95496c] to [fe0644a99a].

345
346
347
348
349
350
351

352
353




354
355
356
357
358
359
360
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365







+


+
+
+
+







	    [[@"foo" stringByDeletingLastPathComponent] isEqual: @"."])

	TEST(@"-[stringByDeletingPathExtension]",
	    [[@"foo.bar" stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[@"foo..bar" stringByDeletingPathExtension] isEqual: @"foo."] &&
	    [[@"/foo./bar" stringByDeletingPathExtension]
	    isEqual: @"/foo./bar"] &&
#ifndef _WIN32
	    [[@"/foo./bar.baz" stringByDeletingPathExtension]
	    isEqual: @"/foo./bar"] &&
#else
	    [[@"/foo./bar.baz" stringByDeletingPathExtension]
	    isEqual: @"\\foo.\\bar"] &&
#endif
	    [[@"foo.bar/" stringByDeletingPathExtension] isEqual: @"foo"] &&
	    [[@".foo" stringByDeletingPathExtension] isEqual: @".foo"] &&
	    [[@".foo.bar" stringByDeletingPathExtension] isEqual: @".foo"])

	TEST(@"-[decimalValue]",
	    [@"1234" decimalValue] == 1234 &&
	    [@"\r\n+123  " decimalValue] == 123 &&