From e66442aedfc08147d4cd86706e53ebc4198844c6 Mon Sep 17 00:00:00 2001 From: tetragon Date: Thu, 22 Nov 2007 19:44:24 +0000 Subject: Some work towards getting metatrontech's preprocess function to work git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1891 4979c152-3d1c-0410-bac9-87ea11338e46 --- t/04-template-handling.t | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 't') diff --git a/t/04-template-handling.t b/t/04-template-handling.t index 27e63bf3..e5cd0347 100644 --- a/t/04-template-handling.t +++ b/t/04-template-handling.t @@ -344,6 +344,31 @@ SKIP: { 'Template, render (PDF): testfile removed'); } +######################################### +## LedgerSMB::Template private methods ## +######################################### + +use Math::BigFloat; +$template = undef; +$template = new LedgerSMB::Template('user' => {numberformat => '1.000,00'}, + 'format' => 'HTML', 'template' => '04-template', 'no_auto_output' => 1); +ok(defined $template, + 'Template, private (_preprocess): Object creation with format and template'); +isa_ok($template, 'LedgerSMB::Template', + 'Template, private (_preprocess): Object creation with format and template'); +my $number = Math::BigFloat->new(17.5); +isa_ok($number, 'Math::BigFloat', + 'Template, private (_preprocess): number'); +$template->_preprocess($number); +cmp_ok($number, 'eq', '17,50', + 'Template, private (_preprocess): Math::BigFloat conversion'); +$number = [Math::BigFloat->new(1008.51), 'hello']; +$template->_preprocess($number); +cmp_ok($number->[0], 'eq', '1.008,51', + 'Template, private (_preprocess): Math::BigFloat conversion (array)'); +cmp_ok($number->[1], 'eq', 'hello', + 'Template, private (_preprocess): no conversion (array)'); + ################################### ## LedgerSMB::Template::Elements ## ################################### -- cgit v1.2.3