ObjFW  Check-in [fe4cb7d169]

Overview
Comment:Remove OFFileTests as we don't use it anymore.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fe4cb7d169a47c05dc5c217137a43bfe98bb2a2af4fd70c2e01c3c7dc708aef2
User & Date: js on 2011-03-22 20:59:06
Other Links: manifest | tags
Context
2011-03-23
00:19
Add new methods to OFString. check-in: b682102c3d user: js tags: trunk
2011-03-22
20:59
Remove OFFileTests as we don't use it anymore. check-in: fe4cb7d169 user: js tags: trunk
20:57
Rename remove to delete in OFMutableString. check-in: c9e2f6b548 user: js tags: trunk
Changes

Deleted tests/OFFileTests.m version [df8abd12a3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * Copyright (c) 2008, 2009, 2010, 2011
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFFile.h"
#import "OFString.h"
#import "OFAutoreleasePool.h"
#import "OFArray.h"
#import "OFExceptions.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFFile";

@implementation TestsAppDelegate (OFFileTests)
- (void)fileTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFArray *tmp;

	TEST(@"+[componentsOfPath:]",
	    /* /tmp */
	    (tmp = [OFFile componentsOfPath: @"/tmp"]) &&
	    [tmp count] == 2 &&
	    [[tmp objectAtIndex: 0] isEqual: @""] &&
	    [[tmp objectAtIndex: 1] isEqual: @"tmp"] &&
	    /* /tmp/ */
	    (tmp = [OFFile componentsOfPath: @"/tmp/"]) &&
	    [tmp count] == 2 &&
	    [[tmp objectAtIndex: 0] isEqual: @""] &&
	    [[tmp objectAtIndex: 1] isEqual: @"tmp"] &&
	    /* / */
	    (tmp = [OFFile componentsOfPath: @"/"]) &&
	    [tmp count] == 1 &&
	    [[tmp objectAtIndex: 0] isEqual: @""] &&
	    /* foo/bar */
	    (tmp = [OFFile componentsOfPath: @"foo/bar"]) &&
	    [tmp count] == 2 &&
	    [[tmp objectAtIndex: 0] isEqual: @"foo"] &&
	    [[tmp objectAtIndex: 1] isEqual: @"bar"] &&
	    /* foo/bar/baz/ */
	    (tmp = [OFFile componentsOfPath: @"foo/bar/baz"]) &&
	    [tmp count] == 3 &&
	    [[tmp objectAtIndex: 0] isEqual: @"foo"] &&
	    [[tmp objectAtIndex: 1] isEqual: @"bar"] &&
	    [[tmp objectAtIndex: 2] isEqual: @"baz"] &&
	    /* foo// */
	    (tmp = [OFFile componentsOfPath: @"foo//"]) &&
	    [tmp count] == 2 &&
	    [[tmp objectAtIndex: 0] isEqual: @"foo"] &&
	    [[tmp objectAtIndex: 1] isEqual: @""] &&
	    [[OFFile componentsOfPath: @""] count] == 0)

	TEST(@"+[lastComponentOfPath:]",
	    [[OFFile lastComponentOfPath: @"/tmp"] isEqual: @"tmp"] &&
	    [[OFFile lastComponentOfPath: @"/tmp/"] isEqual: @"tmp"] &&
	    [[OFFile lastComponentOfPath: @"/"] isEqual: @""] &&
	    [[OFFile lastComponentOfPath: @"foo"] isEqual: @"foo"] &&
	    [[OFFile lastComponentOfPath: @"foo/bar"] isEqual: @"bar"] &&
	    [[OFFile lastComponentOfPath: @"foo/bar/baz/"] isEqual: @"baz"])

	TEST(@"+[directoryNameOfPath:]",
	    [[OFFile directoryNameOfPath: @"/tmp"] isEqual: @"/"] &&
	    [[OFFile directoryNameOfPath: @"/tmp/"] isEqual: @"/"] &&
	    [[OFFile directoryNameOfPath: @"/tmp/foo/"] isEqual: @"/tmp"] &&
	    [[OFFile directoryNameOfPath: @"foo/bar"] isEqual: @"foo"] &&
	    [[OFFile directoryNameOfPath: @"/"] isEqual: @"/"] &&
	    [[OFFile directoryNameOfPath: @"foo"] isEqual: @"."])

	[pool drain];
}
@end
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<