# This seems to demonstrate a bug with "goto &NAME"...

BEGIN { $| = 1; print "1..9\n"; }
END {print "not ok 1\n" unless $loaded;}
use GotoBug;
$loaded = 1;
print "ok 1\n";

$nargs = GotoBug::call_stack();
print (($nargs == 0) ? "ok 2\n" : "not ok 2\n");

$nargs = GotoBug::call_stack(1,1.2,'test',undef,\$loaded);
print (($nargs == 5) ? "ok 3\n" : "not ok 3\n");

print "# (The buggy examples start here...)\n";

$nargs = GotoBug::oops();
print (($nargs == 0) ? "ok 4\n" : "not ok 4\n");

$nargs = GotoBug::oops(1,2,3);
print (($nargs == 3) ? "ok 5\n" : "not ok 5\n");

$nargs = GotoBug::boing();
print (($nargs == 0) ? "ok 6\n" : "not ok 6\n");

$nargs = GotoBug::boing(1,2,3);
print (($nargs == 3) ? "ok 7\n" : "not ok 7\n");

# The following were claiming 16318980 items on stack and dumping core

$nargs = GotoBug::blam(1,2,3);
print (($nargs == 3) ? "ok 9\n" : "not ok 9\n");

$nargs = GotoBug::blam();
print (($nargs == 0) ? "ok 8\n" : "not ok 8\n");

