summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-22 19:44:24 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-22 19:44:24 +0000
commite66442aedfc08147d4cd86706e53ebc4198844c6 (patch)
tree7e5e6d50505f4a8d4967d16430132f27f691a821 /t
parent08e1b04d20e4f328638fbde9f7a2ae54a3dca966 (diff)
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
Diffstat (limited to 't')
-rw-r--r--t/04-template-handling.t25
1 files changed, 25 insertions, 0 deletions
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 ##
###################################