ObjFW  Check-in [a66b075506]

Overview
Comment:Adjust OFObjectTests to OF_WARN_UNUSED_RESULT
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a66b07550611a0e0b45dc711fa16b6e6fb67514883edc4c6140e0a1aa98fe20b
User & Date: js on 2017-11-05 18:06:11
Other Links: manifest | tags
Context
2017-11-05
18:25
Use -[isMemberOfClass:] instead of object_getClass (check-in: 0a4565fb0f user: js tags: trunk)
18:06
Adjust OFObjectTests to OF_WARN_UNUSED_RESULT (check-in: a66b075506 user: js tags: trunk)
18:01
Add OFCharacterSet (check-in: 7c30d6a2e2 user: js tags: trunk)
Changes

Modified tests/OFObjectTests.m from [ba866e7637] to [c3009f964d].

114
115
116
117
118
119
120
121

122
123
124
125
126
127

128
129
130
131
132
133
134
135
136
137
138

139
140
141
142
143
144
145
114
115
116
117
118
119
120

121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
145







-
+





-
+










-
+







	    R([obj freeMemory: r]))

	tmp = [self allocMemoryWithSize: 1024];
	EXPECT_EXCEPTION(@"Detect freeing of memory not allocated by object",
	    OFMemoryNotPartOfObjectException, [obj freeMemory: tmp])

	EXPECT_EXCEPTION(@"Detect out of memory on alloc",
	    OFOutOfMemoryException, [obj allocMemoryWithSize: TOO_BIG])
	    OFOutOfMemoryException, tmp = [obj allocMemoryWithSize: TOO_BIG])

	EXPECT_EXCEPTION(@"Detect out of memory on resize",
	    OFOutOfMemoryException,
	    {
		p = [obj allocMemoryWithSize: 1];
		[obj resizeMemory: p
		p = [obj resizeMemory: p
			     size: TOO_BIG];
	    })
	[obj freeMemory: p];

	TEST(@"Allocate when trying to resize NULL",
	    (p = [obj resizeMemory: NULL
			      size: 1024]) != NULL)
	[obj freeMemory: p];

	EXPECT_EXCEPTION(@"Detect resizing of memory not allocated by object",
	    OFMemoryNotPartOfObjectException, [obj resizeMemory: tmp
	    OFMemoryNotPartOfObjectException, tmp = [obj resizeMemory: tmp
							   size: 2048])
	[self freeMemory: tmp];

	TEST(@"+[description]",
	    [[OFObject description] isEqual: @"OFObject"] &&
	    [[MyObj description] isEqual: @"MyObj"])