Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 46 lines (34 sloc) 0.876 kb
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
use strict;
use warnings;
use Test::More;
use Test::MockObject;
use Data::Section::Simple;

use Apache2::RequestUtil;
use Apache2::Data::Section::Simple;

my $mock = Test::MockObject->new;
$mock->fake_module(
    'Apache2::RequestUtil',
    request => sub { bless {}, 'Request::Dummy' }
);

$mock->fake_module(
    'Request::Dummy',
    filename => sub { $0 }
);

my $expected = Data::Section::Simple::get_data_section;

subtest 'OO style' => sub {
    my $dss = new_ok 'Apache2::Data::Section::Simple';
    my $got = $dss->get_data_section;
    is_deeply $got, $expected, 'data section ok'
        or diag explain $got;
};

subtest 'Functional style' => sub {
    my $got = Apache2::Data::Section::Simple::get_data_section;
    is_deeply $got, $expected, 'data section ok'
        or diag explain $got;
};

done_testing;

__DATA__

@@ foo

This is foo.

@@ bar

This is bar.
Something went wrong with that request. Please try again.