ObjFW  Diff

Differences From Artifact [24325e2282]:

To Artifact [decdd17638]:


54
55
56
57
58
59
60
61

62
63
64
65
66

67
68
69

70
71
72
73
74
75
76
77
54
55
56
57
58
59
60

61

62
63
64

65



66

67
68
69
70
71
72
73







-
+
-



-
+
-
-
-
+
-








	@try {
		uint16_t port;

		_testsAppDelegate = testsAppDelegate;

		_server = [[OFTCPSocket alloc] init];
		port = [_server bindToHost: @"127.0.0.1"
		port = [_server bindToHost: @"127.0.0.1" port: 0];
				      port: 0];
		[_server listen];

		_client = [[OFTCPSocket alloc] init];
		[_client connectToHost: @"127.0.0.1"
		[_client connectToHost: @"127.0.0.1" port: port];
				  port: port];

		[_client writeBuffer: "0"
		[_client writeBuffer: "0" length: 1];
			      length: 1];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
145
146
147
148
149
150
151

152

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

172

173
174
175
176
177
178
179







-
+
-



















-
+
-







		[_testsAppDelegate
		    outputTesting: @"-[observe] with data ready to read"
			 inModule: module];

		break;
	case 1:
		if (object == _accepted &&
		    [object readIntoBuffer: &buf
		    [object readIntoBuffer: &buf length: 1] == 1 && buf == '0')
				    length: 1] == 1 && buf == '0')
			[_testsAppDelegate
			    outputSuccess: @"-[observe] with data ready to read"
				 inModule: module];
		else {
			[_testsAppDelegate
			    outputFailure: @"-[observe] with data ready to read"
				 inModule: module];
			_fails++;
		}

		[_client close];

		[_testsAppDelegate
		    outputTesting: @"-[observe] with closed connection"
			 inModule: module];

		break;
	case 2:
		if (object == _accepted &&
		    [object readIntoBuffer: &buf
		    [object readIntoBuffer: &buf length: 1] == 0)
				    length: 1] == 0)
			[_testsAppDelegate
			    outputSuccess: @"-[observe] with closed connection"
				 inModule: module];
		else {
			[_testsAppDelegate
			    outputFailure: @"-[observe] with closed connection"
				 inModule: module];