package tests::ReportParserLaTeXDocBookFormatterTest; use strict; use base qw/ Lire::Test::TestCase /; use Lire::ReportParser::LaTeXDocBookFormatter qw/ dbk2latex /; sub set_up { my $self = $_[0]; $self->SUPER::set_up(); return; } sub tear_down { my $self = $_[0]; $self->SUPER::tear_down(); return; } sub test_List { my $self = $_[0]; my $latex = dbk2latex( < This is an itemized list This list is rendered through the itemize list environment. First item. Second item. Third item. With two paragraphs. Last item. EOF $self->assert_str_equals( < First term First definition. Second term Second definition. Using two paragraphs. EOF $self->assert_str_equals( <Paragraphs content\n is wrapped to 72 columns and ends with an extra newline. The paragraph original white space is ignored and LaTex characters like '#' and '\\' are escaped. EOF my $e_text = <assert_str_equals( $e_text, $latex ); } sub test_Para_block_layout { my $self = $_[0]; my $latex = dbk2latex( <This is a paragraph which contain an admonition: This is an admonition. And this finishes the paragraph. EOF my $e_text = <assert_str_equals( $e_text, $latex ); } sub test_Admonition { my $self = $_[0]; my $latex = dbk2latex( < Perl can be hazardous to your mental health Too much perl hacking can cause headaches, depression and/or anxiety attacks. EOF $self->assert_str_equals( < Of course this was a joke. EOF $self->assert_str_equals( <assert_str_equals( $e_text, dbk2latex( $dbk_text ) ); return; } sub test_Email { my $self = $_[0]; my $dbk_text = 'An email@address.com.'; my $e_text = <assert_str_equals( $e_text, dbk2latex( $dbk_text ) ); } sub test_Superscript { my $self = $_[0]; $self->assert_str_equals( "A \\raisebox{1ex}{superscript}.\n\n", dbk2latex( 'A superscript.') ); } sub test_Subscript { my $self = $_[0]; $self->assert_str_equals( "A \\raisebox{-1ex}{subscript}.\n\n", dbk2latex( 'A subscript.') ); } sub test_TextTT { my $self = $_[0]; $self->assert_str_equals( "Run the \\texttt{lire} command.\n\n", dbk2latex( 'Run the lire command.') ); } sub test_Slanted { my $self = $_[0]; $self->assert_str_equals( "A \\textsl{variable}.\n\n", dbk2latex( 'A variable.') ); } 1;