| 1 | #!/usr/bin/perl -w
|
|---|
| 2 |
|
|---|
| 3 | BEGIN {
|
|---|
| 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 |
|
|---|
| 13 | chdir 't';
|
|---|
| 14 |
|
|---|
| 15 | use MakeMaker::Test::Utils;
|
|---|
| 16 | use Test::More tests => 6;
|
|---|
| 17 | use File::Spec;
|
|---|
| 18 |
|
|---|
| 19 | my $TB = Test::More->builder;
|
|---|
| 20 |
|
|---|
| 21 | BEGIN { use_ok('ExtUtils::MM') }
|
|---|
| 22 |
|
|---|
| 23 | my $mm = bless { NAME => "Foo" }, 'MM';
|
|---|
| 24 | isa_ok($mm, 'ExtUtils::MakeMaker');
|
|---|
| 25 | isa_ok($mm, 'ExtUtils::MM_Any');
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | sub 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.
|
|---|
| 41 | try_oneliner(q{print "foo'o", ' bar"ar'}, [], q{foo'o bar"ar}, 'quotes');
|
|---|
| 42 |
|
|---|
| 43 | # How about dollar signs?
|
|---|
|
|---|