Debian Codegraph @

terps/tads/tads3/test/data/setsc.t

raw
1 #include <tads.h>
2
3 class A: object
4 name = 'class A'
5 prop1 { "A.prop1... "; inherited(); }
6 ;
7
8 class B: object
9 name = 'class B'
10 prop1 { "B.prop1... "; inherited(); }
11 ;
12
13 class C: object
14 name = 'class C'
15 prop1 { "C.prop1... "; inherited(); }
16 ;
17
18 class D: A, B, C
19 name = 'class D'
20 prop1 { "D.prop1... "; inherited(); }
21 ;
22
23 objA: A;
24 objB: B;
25 objC: C;
26 objD: D;
27
28 main(args)
29 {
30 local obj;
31
32 test('objA', objA);
33 test('objB', objB);
34 test('objC', objC);
35 test('objD', objD);
36
37 obj = new D();
38 test('new D', obj);
39
40 objD.setSuperclassList([TadsObject]);
41 test('objD modified to [TadsObject]', objD);
42
43 objD.setSuperclassList([A, C]);
44 test('objD modified to [A, C]', objD);
45
46 obj.setSuperclassList([B, C]);
47 test('new D modified to [B, C]', obj);
48
49 obj.setSuperclassList([A, B, C]);
50 test('new D restored to [A, B, C]', obj);
51
52 C.setSuperclassList([B]);
53 test('new D after changing C to [B]', obj);
54 }
55
56 test(id, obj)
57 {
58 "<<id>>:
59 \n\t<<obj.name>>
60 \n\t<<obj.prop1>>
61 \b";
62 }