ObjFW  Check-in [f4bb3f5a76]

Overview
Comment:ObjFWTest: Make sure classes are initialized

This fixes it with the ObjFW runtime again, which was broken by the last
change that as a side effect no longer initialized classes. However,
before class_getSuperclass() can be called in the ObjFW runtime, the
class needs to be initialized.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f4bb3f5a76a5a498178d84e7b68550cb4246715e26e95c85b00f6faca8442202
User & Date: js on 2024-02-10 14:16:02
Other Links: manifest | tags
Context
2024-02-11
11:56
ObjFWTest: Add OTAssert(Not)Nil check-in: ef40fca9fd user: js tags: trunk
2024-02-10
14:16
Merge trunk into branch "objfwtest" check-in: d365229b6e user: js tags: objfwtest
14:16
ObjFWTest: Make sure classes are initialized check-in: f4bb3f5a76 user: js tags: trunk
14:00
ObjFWTest: Don't rely on +[isSubclassOfClass:] check-in: f5b4f0fa39 user: js tags: trunk
Changes

Modified src/test/OTAppDelegate.m from [1f6282da2f] to [94d0e3c3f7].

46
47
48
49
50
51
52
53












54
55

56
57
58
59
60
61
62

	if (classes == NULL)
		return nil;

	@try {
		testClasses = [OFMutableSet set];

		for (Class *iter = classes; *iter != Nil; iter++)












			if (isSubclassOfClass(*iter, [OTTestCase class]))
				[testClasses addObject: *iter];

	} @finally {
		OFFreeMemory(classes);
	}

	[testClasses removeObject: [OTTestCase class]];

	[testClasses makeImmutable];







|
>
>
>
>
>
>
>
>
>
>
>
>


>







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

	if (classes == NULL)
		return nil;

	@try {
		testClasses = [OFMutableSet set];

		for (Class *iter = classes; *iter != Nil; iter++) {
			/*
			 * Make sure the class is initialized.
			 * Required for the ObjFW runtime, as otherwise
			 * class_getSuperclass() crashes.
			 */
			[*iter class];

			/*
			 * Don't use +[isSubclassOfClass:], as the Apple runtime
			 * can return (presumably internal?) classes that don't
			 * implement it, resulting in a crash.
			 */
			if (isSubclassOfClass(*iter, [OTTestCase class]))
				[testClasses addObject: *iter];
		}
	} @finally {
		OFFreeMemory(classes);
	}

	[testClasses removeObject: [OTTestCase class]];

	[testClasses makeImmutable];