Commit | Line | Data |
39234879 |
1 | #!/usr/bin/perl -w |
c7a17d47 |
2 | |
3 | BEGIN { |
39234879 |
4 | if( $ENV{PERL_CORE} ) { |
5 | chdir 't' if -d 't'; |
6 | @INC = '../lib'; |
7 | } |
f6d6199c |
8 | else { |
9 | unshift @INC, 't/lib'; |
10 | } |
c7a17d47 |
11 | } |
39234879 |
12 | chdir 't'; |
c7a17d47 |
13 | |
87a750c3 |
14 | BEGIN { |
15 | use Test::More; |
16 | |
85c35b1b |
17 | if( $^O =~ /^VMS|os2|MacOS|MSWin32|cygwin|beos|netware$/i ) { |
87a750c3 |
18 | plan skip_all => 'Non-Unix platform'; |
19 | } |
20 | else { |
f6d6199c |
21 | plan tests => 107; |
87a750c3 |
22 | } |
23 | } |
c7a17d47 |
24 | |
25 | BEGIN { use_ok( 'ExtUtils::MM_Unix' ); } |
26 | |
f2cc0c2f |
27 | $VERSION = '0.02'; |
c7a17d47 |
28 | use strict; |
29 | use File::Spec; |
30 | |
31 | my $class = 'ExtUtils::MM_Unix'; |
32 | |
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)'); |
41 | |
f2cc0c2f |
42 | cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606'); |
c7a17d47 |
43 | |
44 | # when the following calls like canonpath, catdir etc are replaced by |
45 | # File::Spec calls, the test's become a bit pointless |
46 | |
47 | foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) ) |
48 | { |
49 | is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_"); |
50 | } |
51 | |
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'); |
56 | |
f2cc0c2f |
57 | is ($class->file_name_is_absolute('Bombdadil'), |
58 | File::Spec->file_name_is_absolute('Bombdadil'), |
59 | 'file_name_is_absolute()'); |
60 | |
61 | is ($class->path(), File::Spec->path(), 'path() same as File::Spec->path()'); |
62 | |
c7a17d47 |
63 | foreach (qw/updir curdir rootdir/) |
64 | { |
65 | is ($class->$_(), File::Spec->$_(), $_ ); |
66 | } |
67 | |
68 | foreach ( qw / |
69 | c_o |
70 | clean |
71 | const_cccmd |
72 | const_config |
73 | const_loadlibs |
74 | constants |
75 | depend |
76 | dir_target |
77 | dist |
78 | dist_basics |
79 | dist_ci |
80 | dist_core |
81 | dist_dir |
82 | dist_test |
83 | dlsyms |
84 | dynamic |
85 | dynamic_bs |
86 | dynamic_lib |
87 | exescan |
88 | export_list |
89 | extliblist |
c7a17d47 |
90 | find_perl |
91 | fixin |
92 | force |
93 | guess_name |
c7a17d47 |
94 | init_dirscan |
95 | init_main |
96 | init_others |
97 | install |
98 | installbin |
c7a17d47 |
99 | linkext |
100 | lsdir |
101 | macro |
102 | makeaperl |
103 | makefile |
104 | manifypods |
c7a17d47 |
105 | maybe_command_in_dirs |
106 | needs_linking |
c7a17d47 |
107 | pasthru |
c7a17d47 |
108 | perldepend |
109 | pm_to_blib |
c7a17d47 |
110 | ppd |
111 | prefixify |
112 | processPL |
113 | quote_paren |
114 | realclean |
c7a17d47 |
115 | static |
116 | static_lib |
117 | staticmake |
118 | subdir_x |
119 | subdirs |
120 | test |
121 | test_via_harness |
122 | test_via_script |
123 | tool_autosplit |
124 | tool_xsubpp |
125 | tools_other |
126 | top_targets |
127 | writedoc |
128 | xs_c |
129 | xs_cpp |
130 | xs_o |
131 | xsubpp_version |
132 | / ) |
133 | { |
f6d6199c |
134 | can_ok($class, $_); |
c7a17d47 |
135 | } |
136 | |
f2cc0c2f |
137 | ############################################################################### |
138 | # some more detailed tests for the methods above |
139 | |
140 | ok ( join (' ', $class->dist_basics()), 'distclean :: realclean distcheck'); |
141 | |
142 | ############################################################################### |
143 | # has_link_code tests |
144 | |
145 | my $t = {}; bless $t,$class; |
146 | $t->{HAS_LINK_CODE} = 1; |
147 | is ($t->has_link_code(),1,'has_link_code'); is ($t->{HAS_LINK_CODE},1); |
148 | |
149 | $t->{HAS_LINK_CODE} = 0; |
150 | is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0); |
151 | |
152 | delete $t->{HAS_LINK_CODE}; delete $t->{OBJECT}; |
153 | is ($t->has_link_code(),0); is ($t->{HAS_LINK_CODE},0); |
154 | |
155 | delete $t->{HAS_LINK_CODE}; $t->{OBJECT} = 1; |
156 | is ($t->has_link_code(),1); is ($t->{HAS_LINK_CODE},1); |
157 | |
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); |
160 | |
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); |
163 | |
164 | ############################################################################### |
165 | # libscan |
166 | |
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'); |
171 | |
172 | ############################################################################### |
173 | # maybe_command |
174 | |
175 | is ($t->maybe_command('blargel'),undef,"'blargel' isn't a command"); |
176 | |
177 | ############################################################################### |
178 | # nicetext (dummy method) |
179 | |
180 | is ($t->nicetext('LOTR'),'LOTR','nicetext'); |
181 | |
182 | ############################################################################### |
183 | # parse_version |
184 | |
39234879 |
185 | my $self_name = $ENV{PERL_CORE} ? '../lib/ExtUtils/t/MM_Unix.t' |
186 | : 'MM_Unix.t'; |
f2cc0c2f |
187 | |
188 | is ($t->parse_version($self_name),'0.02', |
189 | 'parse_version on ourself'); |
190 | |
191 | ############################################################################### |
192 | # perl_script (on unix any ordinary, readable file) |
193 | |
194 | is ($t->perl_script($self_name),$self_name, 'we pass as a perl_script()'); |
195 | |
196 | ############################################################################### |
197 | # perm_rw perm_rwx |
198 | |
199 | is ($t->perm_rw(),'644', 'perm_rw() is 644'); |
200 | is ($t->perm_rwx(),'755', 'perm_rwx() is 755'); |
201 | |
202 | ############################################################################### |
203 | # post_constants, postamble, post_initialize |
204 | |
205 | foreach (qw/ post_constants postamble post_initialize/) |
206 | { |
207 | is ($t->$_(),'', "$_() is an empty string"); |
208 | } |
209 | |
210 | ############################################################################### |
211 | # replace_manpage_separator |
212 | |
213 | is ($t->replace_manpage_separator('Foo/Bar'),'Foo::Bar','manpage_separator'); |
214 | |
215 | ############################################################################### |
216 | # export_list, perl_archive, perl_archive_after |
217 | |
218 | foreach (qw/ export_list perl_archive perl_archive_after/) |
219 | { |
220 | is ($t->$_(),'',"$_() is empty string on Unix"); |
221 | } |
222 | |
c7a17d47 |
223 | |