4 if( $ENV{PERL_CORE} ) {
14 if( $^O =~ /^VMS|os2|MacOS|MSWin32|cygwin|beos|netware$/i ) {
15 plan skip_all => 'Non-Unix platform';
22 BEGIN { use_ok( 'ExtUtils::MM_Unix' ); }
28 my $class = 'ExtUtils::MM_Unix';
30 # only one of the following can be true
31 # test should be removed if MM_Unix ever stops handling other OS than Unix
32 my $os = ($ExtUtils::MM_Unix::Is_OS2 || 0)
33 + ($ExtUtils::MM_Unix::Is_Mac || 0)
34 + ($ExtUtils::MM_Unix::Is_Win32 || 0)
35 + ($ExtUtils::MM_Unix::Is_Dos || 0)
36 + ($ExtUtils::MM_Unix::Is_VMS || 0);
37 ok ( $os <= 1, 'There can be only one (or none)');
39 cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606');
41 # when the following calls like canonpath, catdir etc are replaced by
42 # File::Spec calls, the test's become a bit pointless
44 foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) )
46 is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
49 is ($class->catdir('xx','xx'), File::Spec->catdir('xx','xx'),
50 'catdir(xx, xx) => xx/xx');
51 is ($class->catfile('xx','xx','yy'), File::Spec->catfile('xx','xx','yy'),
52 'catfile(xx, xx) => xx/xx');
54 is ($class->file_name_is_absolute('Bombdadil'),
55 File::Spec->file_name_is_absolute('Bombdadil'),
56 'file_name_is_absolute()');
58 is ($class->path(), File::Spec->path(), 'path() same as File::Spec->path()');
60 foreach (qw/updir curdir rootdir/)
62 is ($class->$_(), File::Spec->$_(), $_ );
103 maybe_command_in_dirs
132 ok ($class->can ($_), "can $_");
135 ###############################################################################
136 # some more detailed tests for the methods above
138 ok ( join (' ', $class->dist_basics()), 'distclean :: realclean distcheck');
140 ###############################################################################
141 # has_link_code tests
143 my $t = {}; bless $t,$class;
144 $t->{HAS_LINK_CODE} = 1;
145 is ($t->has_link_code(),1,'has_link_code'); is ($t->{HAS_LINK_CODE},1);
147 $t->{HAS_LINK_CODE} = 0;
148 is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0);
150 delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT};
151 is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0);
153 delete $t->{HAS_LINK_CODE}; $t->{OBJECT} = 1;
154 is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
156 delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT}; $t->{MYEXTLIB} = 1;
157 is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
159 delete $t->{HAS_LINK_CODE}; delete $t->{MYEXTLIB}; $t->{C} = [ 'Gloin' ];
160 is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1);
162 ###############################################################################
165 is ($t->libscan('RCS'),'','libscan on RCS');
166 is ($t->libscan('CVS'),'','libscan on CVS');
167 is ($t->libscan('SCCS'),'','libscan on SCCS');
168 is ($t->libscan('Fatty'),'Fatty','libscan on something not RCS, CVS or SCCS');
170 ###############################################################################
173 is ($t->maybe_command('blargel'),undef,"'blargel' isn't a command");
175 ###############################################################################
176 # nicetext (dummy method)
178 is ($t->nicetext('LOTR'),'LOTR','nicetext');
180 ###############################################################################
183 my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t'
186 is ($t->parse_version($self_name),'0.02',
187 'parse_version on ourself');
189 ###############################################################################
190 # perl_script (on unix any ordinary, readable file)
192 is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()');
194 ###############################################################################
197 is ($t->perm_rw(),'644', 'perm_rw() is 644');
198 is ($t->perm_rwx(),'755', 'perm_rwx() is 755');
200 ###############################################################################
201 # post_constants, postamble, post_initialize
203 foreach (qw/ post_constants postamble post_initialize/)
205 is ($t->$_(),'', "$_() is an empty string");
208 ###############################################################################
209 # replace_manpage_separator
211 is ($t->replace_manpage_separator('Foo/Bar'),'Foo::Bar','manpage_separator');
213 ###############################################################################
214 # export_list, perl_archive, perl_archive_after
216 foreach (qw/ export_list perl_archive perl_archive_after/)
218 is ($t->$_(),'',"$_() is empty string on Unix");