* examples/pasm/fact.pasm:
[parrot.git] / t / dynpmc / sub.t
blob6d1e2a1c6471625235e9f3fae5e7d9f7df134755
1 #! perl
2 # Copyright (C) 2005-2007, The Perl Foundation.
3 # $Id$
5 use strict;
6 use warnings;
7 use lib qw( . lib ../lib ../../lib );
8 use Test::More;
9 use Parrot::Test tests => 2;
10 use Parrot::Config;
12 =head1 NAME
14 t/dynpmc/sub.t - test if Sub is overridable by .HLL_map
16 =head1 SYNOPSIS
18         % prove t/dynpmc/sub.t
20 =head1 DESCRIPTION
22 Tests the .HLL_map of Sub PMCs. The test is using .SubProxy, which
23 happens to be a .Sub.
25 =cut
27 pir_output_is( << 'CODE', << 'OUTPUT', "loadlib" );
28 .sub main :main
29     .local pmc lib
30     lib = loadlib "subproxy"
31     unless lib goto not_loaded
32     print "ok\n"
33     end
34 not_loaded:
35     print "not loaded\n"
36 .end
37 CODE
39 OUTPUT
41 pir_output_is( << 'CODE', << 'OUTPUT', "test type of HLL_mapped .Sub" );
42 .sub main :main
43     .const .Sub b = 'bar'
44     $S0 = typeof b
45     print $S0
46     print "\n"
47     .const .Sub f = 'foo'
48     $S0 = typeof f
49     print $S0
50     print "\n"
51 .end
53 .sub bar
54     noop
55 .end
57 .HLL "Some", "subproxy"
58 .HLL_map "Sub", "SubProxy"
60 .sub foo
61     noop
62 .end
63 CODE
64 Sub
65 SubProxy
66 OUTPUT
68 # Local Variables:
69 #   mode: cperl
70 #   cperl-indent-level: 4
71 #   fill-column: 100
72 # End:
73 # vim: expandtab shiftwidth=4: