ljr/wcmtools/s2/tests/defined.s2

41 lines
509 B
Plaintext
Raw Normal View History

2019-02-05 21:49:12 +00:00
#-*-c++-*-
layerinfo "type" = "core";
layerinfo "majorversion" = 1;
class string {
function repeat () : string;
}
class Foo {
var string foo;
}
function main ()
{
var Foo f;
if (defined $f) {
print "fail.\n";
} else {
print "pass.\n";
}
$f = new Foo;
if (defined $f) {
print "pass.\n";
} else {
print "fail.\n";
}
$f = null Foo;
if (defined $f) {
print "fail.\n";
} else {
print "pass.\n";
}
}