4 if( $ENV{PERL_CORE} ) {
17 if( $^O =~ /^VMS|os2|MacOS|MSWin32|cygwin|beos|netware$/i ) {
18 plan skip_all => 'Non-Unix platform';
25 BEGIN { use_ok( 'ExtUtils::MM_Unix' ); }
31 my $class = 'ExtUtils::MM_Unix';
33 # only one of the following can be true
34 # test should be removed if MM_Unix ever stops handling other OS than Unix
35 my $os = ($ExtUtils::MM_Unix::Is_OS2 || 0)
36 + ($ExtUtils::MM_Unix::Is_Mac || 0)
37 + ($ExtUtils::MM_Unix::Is_Win32 || 0)
38 + ($ExtUtils::MM_Unix::Is_Dos || 0)
39 + ($ExtUtils::MM_Unix::Is_VMS || 0);
40 ok ( $os <= 1, 'There can be only one (or none)');
42 cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606');
44 # when the following calls like canonpath, catdir etc are replaced by
45 # File::Spec calls, the test's become a bit pointless
47 foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) )
49 is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
52 is ($class->catdir('xx','xx'), File::Spec->catdir('xx','xx'),
53 'catdir(xx, xx) => xx/xx');
54 is ($class->catfile('xx','xx','yy'), File::Spec->catfile('xx','xx','yy'),
55 'catfile(xx, xx) => xx/xx');
57 is ($class->file_name_is_absolute('Bombdadil'),
58 File::Spec->file_name_is_absolute('Bombdadil'),
59 'file_name_is_absolute()');
61 is ($class->path(), File::Spec->path(), 'path() same as File::Spec->path()');
63 foreach (qw/updir curdir rootdir/)
65 is ($class->$_(), File::Spec->$_(), $_ );
105 maybe_command_in_dirs
137 ###############################################################################
138 # some more detailed tests for the methods above
140 ok ( join (' ', $class->dist_basics()), 'distclean :: realclean distcheck');
142 ###############################################################################
143 # has_link_code tests
145 my $t = bless { NAME => "Foo" }, $class;
146 $t->{HAS_LINK_CODE} = 1;
147 is ($t->has_link_code(),1,'has_link_code'); is ($t->{HAS_LINK_CODE},1);
149 $t->{HAS_LINK_CODE} = 0;
150 is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0);
152 delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT};
153 is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0);
155 delete $t->{HAS_LINK_CODE}; $t->{OBJECT} = 1;
156 is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
158 delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT}; $t->{MYEXTLIB} = 1;
159 is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
161 delete $t->{HAS_LINK_CODE}; delete $t->{MYEXTLIB}; $t->{C} = [ 'Gloin' ];
162 is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
164 ###############################################################################
167 is ($t->libscan('RCS'),'','libscan on RCS');
168 is ($t->libscan('CVS'),'','libscan on CVS');
169 is ($t->libscan('SCCS'),'','libscan on SCCS');
170 is ($t->libscan('Fatty'),'Fatty','libscan on something not RCS, CVS or SCCS');
172 ###############################################################################
175 is ($t->maybe_command('blargel'),undef,"'blargel' isn't a command");
177 ###############################################################################
178 # nicetext (dummy method)
180 is ($t->nicetext('LOTR'),'LOTR','nicetext');
182 ###############################################################################
185 my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t'
188 is ($t->parse_version($self_name),'0.02',
189 'parse_version on ourself');
191 ###############################################################################
192 # perl_script (on unix any ordinary, readable file)
194 is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()');
196 ###############################################################################
199 is ($t->perm_rw(),'644', 'perm_rw() is 644');
200 is ($t->perm_rwx(),'755', 'perm_rwx() is 755');
202 ###############################################################################
203 # post_constants, postamble, post_initialize
205 foreach (qw/ post_constants postamble post_initialize/)
207 is ($t->$_(),'', "$_() is an empty string");
210 ###############################################################################
211 # replace_manpage_separator
213 is ($t->replace_manpage_separator('Foo/Bar'),'Foo::Bar','manpage_separator');
215 ###############################################################################
216 # export_list, perl_archive, perl_archive_after
218 foreach (qw/ export_list perl_archive perl_archive_after/)
220 is ($t->$_(),'',"$_() is empty string on Unix");
225 $t->{CCFLAGS} = '-DMY_THING';
226 $t->{LIBPERL_A} = 'libperl.a';
227 $t->{LIB_EXT} = '.a';
228 local $t->{NEEDS_LINKING} = 1;
231 # Brief bug where CCFLAGS was being blown away
232 is( $t->{CCFLAGS}, '-DMY_THING', 'cflags retains CCFLAGS' );