PerlPoint-Package
view release on metacpan or search on metacpan
t/l0_cache-fill.t view on Meta::CPAN
# = HISTORY SECTION =====================================================================
# ---------------------------------------------------------------------------------------
# version | date | author | changes
# ---------------------------------------------------------------------------------------
# 0.09 |26.12.2004| JSTENZEL | adapted to new headline path data and table hints;
# |28.12.2004| JSTENZEL | adapted to dotted texts;
# |27.02.2005| JSTENZEL | adapted to fixed variable handling, see parser log;
# |01.11.2005| JSTENZEL | each document needs a headline now;
# 0.08 |20.08.2002| JSTENZEL | adapted to extended tag streaming (body hint);
# 0.07 |< 14.04.02| JSTENZEL | blocks got rid of a trailing newline;
# | | JSTENZEL | added paragraph filter tests using new do() strategy;
# | | JSTENZEL | adapted to headline shortcuts;
# | | JSTENZEL | added document stream tests;
# |15.04.2002| JSTENZEL | adapted to chapter docstream hints;
# 0.06 |18.08.2001| JSTENZEL | switched from Test to Test::More;
# |13.10.2001| JSTENZEL | adapted to headline title providing;
# |27.11.2001| JSTENZEL | adapted to additional shift hints in list directives;
# |01.12.2001| JSTENZEL | adapted to TABLEs modified parameter passing
# | | | (which was built in to support retranslations
# | | | performed when a paragraph filter is assigned);
# 0.05 |22.07.2001| JSTENZEL | adapted to perl 5.005;
# | | JSTENZEL | adapted to improved lexer;
# 0.04 |20.03.2001| JSTENZEL | adapted to tag templates;
# |23.03.2001| JSTENZEL | adapted to by line lexing of verbatim blocks;
# |23.05.2001| JSTENZEL | adapted to field trimming;
# |24.05.2001| JSTENZEL | adapted to paragraph reformatting: text paragraphs
# | | | containing only a table become just a table now;
# |25.05.2001| JSTENZEL | adapted to paragraph reformatting: text paragraphs
# | | | no longer contain a final whitespace string;
# |26.05.2001| JSTENZEL | adapted to new table nesting information;
# |01.06.2001| JSTENZEL | adapted to modified lexing algorithm which takes
# | | | "words" as long as possible;
# 0.03 |30.01.2001| JSTENZEL | ordered lists now provide the entry level number;
# 0.02 |09.12.2000| JSTENZEL | new namespace: "PP" => "PerlPoint";
# 0.01 |16.11.2000| JSTENZEL | new.
# ---------------------------------------------------------------------------------------
# PerlPoint test script
# pragmata
use strict;
use lib qw(t);
use vars qw(@results);
# load modules
use Cwd;
use Carp;
use Safe;
use PerlPoint::Backend;
use Test::More qw(no_plan);
use PerlPoint::Parser 0.40;
use PerlPoint::Constants 0.16;
# helper lib
use testlib;
# declare test tags
use PerlPoint::Tags;
use PerlPoint::Tags::_tags;
# declare variables
my (@streamData);
# build parser
my ($parser)=new PerlPoint::Parser;
# and call it
$parser->run(
stream => \@streamData,
files => ['t/cache.pp'],
safe => new Safe,
docstreams2skip => ['The ignored docstream'],
docstreaming => DSTREAM_DEFAULT,
cache => CACHE_ON+CACHE_CLEANUP,
trace => TRACE_NOTHING,
display => DISPLAY_NOINFO,
);
# build a backend
my $backend=new PerlPoint::Backend(
name => 'installation test: cache init',
trace => TRACE_NOTHING,
display => DISPLAY_NOINFO,
);
# register a complete set of backend handlers
$backend->register($_, \&handler) foreach (DIRECTIVE_BLOCK .. DIRECTIVE_SIMPLE);
# now run the backend
$backend->run(\@streamData);
# perform checks: start
is(shift(@results), $_) foreach (DIRECTIVE_DOCUMENT, DIRECTIVE_START, 'cache.pp');
# variable hash
my $varhash={
_STARTDIR => cwd(),
_PARSER_VERSION => $PerlPoint::Parser::VERSION,
_SOURCE_LEVEL => 1,
};
is(shift(@results), $_) foreach (DIRECTIVE_HEADLINE, DIRECTIVE_START, 1, 'Cache', '');
{
my $docstreams=shift(@results);
is(ref($docstreams), 'ARRAY');
is(join(' ', @$docstreams), '');
}
checkHeadline(\@results, 1, ['Cache'], ['Cache'], [1], [1], $varhash);
is(shift(@results), $_) foreach (DIRECTIVE_SIMPLE, DIRECTIVE_START, 'Cache');
is(shift(@results), $_) foreach (DIRECTIVE_HEADLINE, DIRECTIVE_COMPLETE, 1);
# first table (made by tag)
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_START, 'TABLE');
{
my $pars=shift(@results);
is(ref($pars), 'HASH');
is(join(' ', sort keys %$pars), '__maxColumns__ __nestingLevel__ __titleColumns__ bg border rowseparator separator');
is(join(' ', sort values %$pars), '1 2 3 3 \\\n blue |');
}
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_START, 'TABLE_ROW');
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_START, 'TABLE_COL');
is(shift(@results), $_) foreach (DIRECTIVE_SIMPLE, DIRECTIVE_START, 'Spalte 1');
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_COMPLETE, 'TABLE_COL');
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_START, 'TABLE_COL');
is(shift(@results), $_) foreach (DIRECTIVE_SIMPLE, DIRECTIVE_START, 'Spalte 2');
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_COMPLETE, 'TABLE_COL');
is(shift(@results), $_) foreach (DIRECTIVE_TAG, DIRECTIVE_START, 'TABLE_COL');
is(shift(@results), $_) foreach (DIRECTIVE_SIMPLE, DIRECTIVE_START, 'Spalte 3');
( run in 0.963 second using v1.01-cache-2.11-cpan-140bd7fdf52 )