File: 17-print.t

package info (click to toggle)
libhtml-mason-perl 1%3A1.58-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,796 kB
  • sloc: perl: 8,618; sh: 49; makefile: 2
file content (64 lines) | stat: -rw-r--r-- 1,279 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use strict;

use Cwd;
use File::Spec;

use HTML::Mason::Tests;

print "1..9\n";

my $comp_root = File::Spec->catdir( getcwd(), 'mason_tests', 'comps' );
($comp_root) = $comp_root =~ /(.*)/;
my $data_dir = File::Spec->catdir( getcwd(), 'mason_tests', 'data' );
($data_dir) = $data_dir =~ /(.*)/;

my $tests = HTML::Mason::Tests->tests_class->new( name => 'print',
                                                  description => 'printing to standard output' );

my $interp = HTML::Mason::Tests->tests_class->_make_interp
    ( comp_root => $comp_root,
      data_dir => $data_dir
      );

{
    my $source = <<'EOF';
ok 1
% print "ok 2\n";
EOF

    my $comp = $interp->make_component( comp_source => $source );

    my $req = $interp->make_request(comp=>$comp);

    $req->exec();
}

# same stuff but with autoflush
{
    my $source = <<'EOF';
ok 3
% print "ok 4\n";
EOF

    my $comp = $interp->make_component( comp_source => $source );

    my $req = $interp->make_request( comp=>$comp, autoflush => 1 );

    $req->exec();
}

{
    my $source = <<'EOF';
ok 5
% print "ok 6\n";
ok 7
% print "ok 8\n";
% print "", "ok ", "9", "\n";
EOF

    my $comp = $interp->make_component( comp_source => $source );

    my $req = $interp->make_request( comp=>$comp );

    $req->exec();
}