summaryrefslogtreecommitdiff
path: root/t/10-form.t
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-17 21:15:52 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-17 21:15:52 +0000
commit44d035fe38dac0b91e1fdadb576459f5ec19739a (patch)
tree2ef80eb7922db5b86a76526eb3b16a50bcc69add /t/10-form.t
parent0a4abf20866526b5803ab3fbe0e484ad7cda3588 (diff)
Merging Inifile and Menu into Menufile
Fixed a scope bug in Menufile, and added more tests git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1204 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 't/10-form.t')
-rw-r--r--t/10-form.t65
1 files changed, 37 insertions, 28 deletions
diff --git a/t/10-form.t b/t/10-form.t
index 6c170a80..2a5765e5 100644
--- a/t/10-form.t
+++ b/t/10-form.t
@@ -1,35 +1,25 @@
#!/usr/bin/perl
-##format_amount in 02-number-handling.t
-##parse_amount in 02-number-handling.t
-##round_amount in 02-number-handling.t
-##current_date in 03-date-handling.t
-##split_date in 03-date-handling.t
-##format_date in 03-date-handling.t
-##from_to in 03-date-handling.t
-##datetonum in 03-date-handling.t
-##add_date in 03-date-handling.t
-
-##escape in 10-form.t
-##unescape in 10-form.t
-##quote in 10-form.t
-##unquote in 10-form.t
-##numtextrows in 10-form.t
-##debug in 10-form.t
-##hide_form in 10-form.t
-##info in 10-form.t
-##error in 10-form.t
-##isblank in 10-form.t
-##header in 10-form.t
-##sort_columns in 10-form.t
-##sort_order in 10-form.t
-##print_button in 10-form.t
-
-##encode_all null
-##decode_all null
+#
+# t/10-form.t
+#
+# Tests various functions in LedgerSMB::Form that aren't tested elsewhere.
+#
+
+# format_amount in 02-number-handling.t
+# parse_amount in 02-number-handling.t
+# round_amount in 02-number-handling.t
+# current_date in 03-date-handling.t
+# split_date in 03-date-handling.t
+# format_date in 03-date-handling.t
+# from_to in 03-date-handling.t
+# datetonum in 03-date-handling.t
+# add_date in 03-date-handling.t
+
+# encode_all empty
+# decode_all empty
##sub new {
##sub dberror {
-##sub redirect {
##sub db_parse_numeric {
##sub callproc {
##sub get_my_emp_num {
@@ -91,6 +81,10 @@ sub form_error_func {
print $_[0];
}
+sub redirect {
+ print "redirected\n";
+}
+
my $form = new Form;
my %myconfig;
my $utfstr;
@@ -222,6 +216,7 @@ SKIP: {
is($form->info('hello world'), 'hello world',
'info: CLI, function call');
};
+delete $ENV{info_function};
## $form->error checks
$form = new Form;
@@ -415,3 +410,17 @@ is($trap->stdout, "<button class=\"submit\" type=\"submit\" name=\"action\" valu
## $form->like checks
$form = new Form;
is($form->like('hello world'), '%hello world%', 'like');
+
+## $form->redirect checks
+$form = new Form;
+ok(!defined $form->{callback}, 'redirect: No callback set');
+@r = trap{$form->redirect};
+is($trap->stdout, "redirected\n", 'redirect: No message or callback redirect');
+@r = trap{$form->redirect('hello world')};
+is($trap->stdout, "hello world\n",
+ 'redirect: message, no callback redirect');
+$form->{callback} = 1;
+@r = trap{$form->redirect};
+is($trap->stdout, "redirected\n", 'redirect: callback, no message redirect');
+@r = trap{$form->redirect("hello world\n")};
+is($trap->stdout, "redirected\n", 'redirect: callback and message redirect');