source: vendor/perl/5.8.8/lib/ExtUtils/t/oneliner.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 1.2 KB
Line 
1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't' if -d 't';
6 @INC = ('../lib', 'lib');
7 }
8 else {
9 unshift @INC, 't/lib';
10 }
11}
12
13chdir 't';
14
15use MakeMaker::Test::Utils;
16use Test::More tests => 6;
17use File::Spec;
18
19my $TB = Test::More->builder;
20
21BEGIN { use_ok('ExtUtils::MM') }
22
23my $mm = bless { NAME => "Foo" }, 'MM';
24isa_ok($mm, 'ExtUtils::MakeMaker');
25isa_ok($mm, 'ExtUtils::MM_Any');
26
27
28sub try_oneliner {
29 my($code, $switches, $expect, $name) = @_;
30 my $cmd = $mm->oneliner($code, $switches);
31 $cmd =~ s{\$\(ABSPERLRUN\)}{$^X};
32
33 # VMS likes to put newlines at the end of commands if there isn't
34 # one already.
35 $expect =~ s/([^\n])\z/$1\n/ if $^O eq 'VMS';
36
37 $TB->is_eq(scalar `$cmd`, $expect, $name) || $TB->diag("oneliner:\n$cmd");
38}
39
40# Lets see how it deals with quotes.
41try_oneliner(q{print "foo'o", ' bar"ar'}, [], q{foo'o bar"ar}, 'quotes');
42
43# How about dollar signs?