Acme-Comment

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN


            ### perl get's confused if we type 'use' like this, so we put it in a var.
            my $u = 'use';
            
            ### the dir to include to find our latest Acme::Comment ###
            my $dir = File::Spec->catdir( cwd, 'lib' );

            print $fh <<HERE;
BEGIN { unshift \@INC, '$dir'; }

$u strict;
$u Test::More q[no_plan];

$u Acme::Comment 1.01 type => "$type", one_line => $test->{one_line}, own_line => $test->{own_line};


HERE
            my $start   = $Conf->{$type}->{start};
            my $end     = $Conf->{$type}->{end};
            my $single  = $Conf->{$type}->{single};


            START_END: {
            if( $start && $end ) {

                OWNLINE: {
                if ( !$test->{own_line} ) {

                    ### ALGOL has ; to end it's comments
                    ### so you can't use it with own_line
                    if( $type eq 'ALGOL' ) {
                        print $fh "SKIP:{skip(q[You cannot use 'own_line' with ALGOL],3)}";
                        last START_END;
                    }

                    print $fh <<HERE;
SKIP: {
    ### Test 1 ###
    my \$one = 1;

    $start \$one = 2;
    $end

    ### Check Test 1 ###
    is(\$one, 1, "$type => $what: Standard Multiline");



    ### Test 2 ###
    my \$two = 2;

    $start \$two = 3; $start \$two = 4;
    $end \$two = 5; $end

    ### Check Test 2 ###
    is(\$two, 2, "$type => $what: Nested Multiline");



    ### Test 3 ###
    eval {
        $start this should break
        $end
        1;
    };

    ### Check 3 ###
    ok(!\$@, "$type => $what: Broken Syntax Ignored Multiline");
}
HERE

                } }

                ONELINE: {
                if( $test->{one_line} ) {

                    print $fh <<HERE;
SKIP: {
    ### Test 4 ###
    my \$four = 4;

    $start \$four= 5; $end

    ### Check Test 1 ###
    is(\$four, 4, "$type => $what: Standard Multiline");



    ### Test 5 ###
    my \$five = 5;

    $start \$five = 7; $start \$five = 8; $end \$five = 9; $end

    ### Check Test 5 ###
    is(\$five, 5, "$type => $what: Nested Multiline");


    ### Test 6 ###
    eval {
        $start this should break $end
        1;
    };

    ### Check 6 ###
    ok(!\$@, "$type => $what: Broken Syntax Ignored Multiline");
}
HERE
                } }

                STANDARD: {
                print $fh <<HERE;
### Test 7 ###
my \$seven = 7;

$start
    \$seven = 8;
$end

### Check Test 7 ###
is(\$seven, 7, "$type => $what: Standard Multiline");



### Test 8 ###
my \$eight = 8;

$start
    \$eight = 9;
    $start
        \$eight = 10;
    $end
    \$eight = 11;
$end

### Check Test 8 ###
is(\$eight, 8, "$type => $what: Nested Multiline");

### Test 9 ###
eval {
    $start
        this should break
    $end
    1;
};

### Check 9 ###
ok(!\$@, "$type => $what: Broken Syntax Ignored Multiline");

HERE
                }
            } }

            SINGLE: {
            if($single) {
                    print $fh <<HERE;

my \$ten = 10;
$single \$ten = 11;

is(\$ten, 10, "$type => $what: Standard Single Line");

HERE
            } }


        close $fh;
        }
    }

}

### write the Makefile ###
use ExtUtils::MakeMaker;

WriteMakefile(
	NAME			=> 'Acme::Comment',
	VERSION_FROM	=> 'lib/Acme/Comment.pm', # finds $VERSION
	
	PREREQ_PM		=> {
		'Filter::Simple'    => 0,
		'Test::More'        => 0,
    'Text::Balanced'    => 1.99,
	},
);



( run in 0.682 second using v1.01-cache-2.11-cpan-5a3173703d6 )