2 # Copyright (C) 2005, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 9;
14 t/dynpmc/foo.t - Test for a very simple dynamic PMC
18 % prove t/dynpmc/foo.t
26 pir_output_is( << 'CODE', << 'OUTPUT', "get_integer" );
29 loadlib $P1, "foo_group"
40 pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with relative pathname, no ext" );
42 ## load a relative pathname without the extension. loadlib will convert the
43 ## '/' characters to '\\' on windows.
44 $S0 = "runtime/parrot/dynext/foo_group"
47 ## ensure that we can still make Foo instances.
57 pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with absolute pathname, no ext" );
60 .include "iglobals.pasm"
62 $P12 = $P11[.IGLOBALS_CONFIG_HASH]
65 ## convert cwd to an absolute pathname without the extension, and load it.
66 ## this should always find the version in the build directory, since that's
67 ## the only place "make test" will work.
68 $S0 = concat "/runtime/parrot/dynext/foo_group"
71 ## ensure that we can still make Foo instances.
81 pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with relative pathname & ext" );
83 ## get load_ext in $S0.
84 .include "iglobals.pasm"
86 $P12 = $P11[.IGLOBALS_CONFIG_HASH]
87 $S0 = $P12["load_ext"]
89 ## load a relative pathname with an extension.
90 $S0 = concat "runtime/parrot/dynext/foo_group", $S0
93 ## ensure that we can still make Foo instances.
103 pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with absolute pathname & ext" );
105 ## get cwd in $S0, load_ext in $S1.
106 .include "iglobals.pasm"
108 $P12 = $P11[.IGLOBALS_CONFIG_HASH]
110 $S1 = $P12["load_ext"]
112 ## convert $S0 to an absolute pathname with extension, and load it.
113 ## this should always find the version in the build directory, since that's
114 ## the only place "make test" will work.
115 $S0 = concat $S0, "/runtime/parrot/dynext/foo_group"
116 $S0 = concat $S0, $S1
119 ## ensure that we can still make Foo instances.
130 skip( "No BigInt Lib configured", 1 ) if !$PConfig{gmp};
132 pir_output_is( << 'CODE', << 'OUTPUT', "inherited add" );
135 $P0 = loadlib "foo_group"
157 pir_output_is( <<'CODE', <<'OUTPUT', "Foo subclass isa Integer" );
159 .local pmc F, f, d, r
160 loadlib F, "foo_group"
174 pir_output_is( << 'CODE', << 'OUTPUT', ".HLL 1" );
175 # load our Foo test (pseudo) language
176 # it defines one PMC type "Foo"
180 new $P1, "Foo" # load by name
189 pir_output_is( << 'CODE', << 'OUTPUT', ".HLL 2" );
193 new $P1, 'Foo' # load by index
204 # cperl-indent-level: 4
207 # vim: expandtab shiftwidth=4: