Mercurial > projects > ldc
annotate tests/mini/s.d @ 984:4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Added it to .hgignore.
This gets rid of spurious differences caused by CMake regenerating it differently.
Just run 'cmake .' to get it back in your local checkout.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 19 Feb 2009 13:50:05 +0100 |
parents | d92acb81a583 |
children |
rev | line source |
---|---|
138 | 1 module s; |
2 | |
3 interface Inter | |
4 { | |
5 void inter(); | |
6 } | |
7 | |
8 interface Inter2 | |
9 { | |
10 void inter2(); | |
11 } | |
12 | |
13 interface InterOne : Inter | |
14 { | |
15 void interOne(); | |
16 } | |
17 | |
18 abstract class ClassAbstract : InterOne | |
19 { | |
20 abstract void inter(); | |
21 abstract void interOne(); | |
22 } | |
23 | |
24 class TheClassOne : ClassAbstract | |
25 { | |
26 void inter() | |
27 { | |
28 } | |
29 void interOne() | |
30 { | |
31 } | |
32 } | |
33 | |
34 class TheClassTwo : TheClassOne, Inter2 | |
35 { | |
36 long l; | |
37 double d; | |
38 | |
39 void inter2() | |
40 { | |
41 } | |
42 } | |
43 | |
44 extern(C) int printf(char*, ...); | |
45 | |
46 void main() | |
47 { | |
48 printf("classinfo test\n"); | |
49 { | |
50 auto c = new TheClassOne; | |
51 { | |
52 auto ci = c.classinfo; | |
53 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
54 printf("ci.interfaces.length = %lu\n", ci.interfaces.length); | |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
55 foreach (i, iface; ci.interfaces) |
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
56 printf("i[%d] = %.*s\n", i, iface.classinfo.name.length, iface.classinfo.name.ptr); |
138 | 57 } |
58 } | |
59 { | |
60 auto c = new TheClassTwo; | |
61 { | |
62 auto ci = c.classinfo; | |
63 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
64 printf("ci.interfaces.length = %lu\n", ci.interfaces.length); | |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
65 foreach (i, iface; ci.interfaces) |
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
66 printf("i[%d] = %.*s\n", i, iface.classinfo.name.length, iface.classinfo.name.ptr); |
138 | 67 } |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
68 InterOne i = c; |
138 | 69 { |
70 auto ci = i.classinfo; | |
71 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
72 } | |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
73 auto i2 = cast(Inter2)c; |
138 | 74 { |
75 auto ci = i2.classinfo; | |
76 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
77 } | |
78 auto o = cast(Object)i2; | |
79 { | |
80 auto ci = o.classinfo; | |
81 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
82 } | |
83 } | |
84 } |