summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/special/load-category-3a.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/special/load-category-3a.m')
-rw-r--r--gcc/testsuite/objc.dg/special/load-category-3a.m65
1 files changed, 65 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/special/load-category-3a.m b/gcc/testsuite/objc.dg/special/load-category-3a.m
new file mode 100644
index 000000000..5ce5fac65
--- /dev/null
+++ b/gcc/testsuite/objc.dg/special/load-category-3a.m
@@ -0,0 +1,65 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
+
+/* This test is identical to load-category-2, but the classes and
+ categories are created in inverted order in the modules, to test
+ that you can load classes first, or categories first, and it all
+ still works. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <objc/objc.h>
+
+#include "load-category-3.h"
+
+@implementation TestClass2
++ load
+{
+ printf ("[TestClass2 +load]\n");
+ /* Check superclasses/subclasses +load order. */
+ check_that_load_step_was_completed (0);
+ check_that_load_step_was_not_completed (1);
+ check_that_load_step_was_not_completed (2);
+
+ /* Check that the corresponding category's +load was not done. */
+ check_that_load_step_was_not_completed (4);
+
+ complete_load_step (1);
+}
+@end
+
+@implementation TestClass3
++ load
+{
+ printf ("[TestClass3 +load]\n");
+
+ /* Check superclasses/subclasses +load order. */
+ check_that_load_step_was_completed (0);
+ check_that_load_step_was_completed (1);
+ check_that_load_step_was_not_completed (2);
+
+ /* Check that the corresponding category's +load was not done. */
+ check_that_load_step_was_not_completed (5);
+
+ complete_load_step (2);
+}
+@end
+
+@implementation TestClass1
++ initialize { return self; }
++ load
+{
+ printf ("[TestClass1 +load]\n");
+
+ /* Check superclasses/subclasses +load order. */
+ check_that_load_step_was_not_completed (0);
+ check_that_load_step_was_not_completed (1);
+ check_that_load_step_was_not_completed (2);
+
+ /* Check that the corresponding category's +load was not done. */
+ check_that_load_step_was_not_completed (3);
+
+ complete_load_step (0);
+}
+@end
+
+