File: mason-app.t

package info (click to toggle)
libmason-perl 2.19-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 748 kB
  • sloc: perl: 4,960; makefile: 7; sql: 6; sh: 4
file content (15 lines) | stat: -rw-r--r-- 589 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use File::Temp qw(tempdir);
use Mason::Util qw(write_file);
use Test::More tests => 3;
use warnings;
use strict;

my $tempdir = tempdir( 'mason-app-XXXX', TMPDIR => 1, CLEANUP => 1 );
my $comp_file = "$tempdir/hello.mc";
write_file( $comp_file, "%% has 'd';\nd * 2 = <% \$.d * 2 %>" );
my $output = `$^X bin/mason.pl $comp_file --data-dir $tempdir/data --args '{"d":"4"}'`;
is( $output, "d * 2 = 8\n", 'correct output' );
ok( -f "$tempdir/data/obj/hello.mc.mobj", "object file exists" );
$output = `$^X bin/mason.pl -e '<% 3+3 %>'`;
is( $output, "6\n", 'correct output' );