Debian Codegraph @

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

raw
1 class C: object
2 ;
3
4 foo: C
5 ;
6
7 main(args)
8 {
9 if (defined(foo))
10 "foo is defined\n";
11 if (defined(foo) && foo.ofKind(C))
12 "foo is a C\n";
13
14 if (nil)
15 "nil is true???\n";
16
17 if (defined(bar))
18 "bar is defined\n";
19 if (defined(bar) && bar.ofKind(C))
20 "bar is a C\n";
21
22 if (defined(bar) && bar.ofKind(foo))
23 "bar is a foo\n";
24
25 "\b";
26 local x = __objref(foo, warn);
27 local x1 = __objref(foo);
28 local y = __objref(bar, warn);
29 local y1 = __objref(bar);
30 if (x == nil && x == x1)
31 "foo is undefined\n";
32 else if (defined(foo) && x == foo)
33 "foo is defined\n";
34 else
35 "something is wrong with the foo test\n";
36
37 if (y == nil && y == y1)
38 "bar is undefined\n";
39 else if (defined(bar) && y == bar)
40 "bar is defined\n";
41 else
42 "something is wrong with the bar test\n";
43 }
44