+### try out time_calc
+my $sec;
+ok(($sec = CGI::Ex::time_calc('1m')) == time + 60, "Time_calc ($sec)");
+ok(($sec = CGI::Ex::time_calc('-1m')) == time - 60, "Time_calc ($sec)");
+ok(($sec = CGI::Ex::time_calc('1 m')) == time + 60, "Time_calc ($sec)");
+ok(($sec = CGI::Ex::time_calc('1 min')) == time + 60, "Time_calc ($sec)");
+ok(($sec = CGI::Ex::time_calc('1')) == 1, "Time_calc ($sec)");
+ok(($sec = CGI::Ex::time_calc('now')) == time, "Time_calc ($sec)");
+ok(($sec = CGI::Ex::time_calc(__FILE__)), "Time_calc ($sec)");
+
+###----------------------------------------------------------------###
+
+my $html = "<input type=text name=foo value=''>";
+$form = {foo => 'bar'};
+my $out;
+
+ok(($out = $cgix->fill(scalarref => \$html, form => $form)) =~ /value=([\"\'])bar\1/, "Filled $out");
+ok(($out = $cgix->fill(arrayref => [$html], form => $form)) =~ /value=([\"\'])bar\1/, "Filled $out");
+
+$cgix->fill(text => \$html, form => $form);
+ok($html =~ /value=([\"\'])bar\1/, "Filled $html");
+
+$html = "<form name=foo><input type=text name=baz value=''></form><form name=bar><input type=password name=bim value=''></form>";
+
+$form = {baz => 'bing', bim => 'bang'};
+
+$out = $cgix->fill(scalarref => \$html, form => $form, target => 'foo');
+ok($out =~ /bing/, "Got bing");
+ok($out !~ /bang/, "Didn't get bang");
+
+$out = $cgix->fill(scalarref => \$html, form => $form, target => 'bar');
+ok($out =~ /bang/, "Got bang");
+ok($out !~ /bing/, "Didn't get bing");
+
+$out = $cgix->fill(scalarref => \$html, form => $form, ignore_fields => ['baz']);
+ok($out =~ /bang/, "Got bang");
+ok($out !~ /bing/, "Didn't get bing");
+
+$out = $cgix->fill(scalarref => \$html, form => $form, ignore_fields => ['bim']);
+ok($out =~ /bing/, "Got bing");
+ok($out !~ /bang/, "Didn't get bang");
+
+$out = $cgix->fill(scalarref => \$html, form => $form, fill_password => 1);
+ok($out =~ /bing/, "Got bing");
+ok($out =~ /bang/, "Got bang");
+
+$out = $cgix->fill(scalarref => \$html, form => $form, fill_password => undef);
+ok($out =~ /bing/, "Got bing");
+ok($out =~ /bang/, "Got bang");
+
+$out = $cgix->fill(scalarref => \$html, form => $form, fill_password => 0);
+ok($out =~ /bing/, "Got bing");
+ok($out !~ /bang/, "Didn't get bang");
+
+###----------------------------------------------------------------###
+
+$form = {foo => 'bar'};
+my $val = {foo => {'required' => 1}};
+
+my $e = $cgix->validate($form, $val);
+ok(! $e, "No error");
+
+$form = {};
+$e = $cgix->validate($form, $val);
+ok($e, "Got error");
+ok("$e" =~ /required/i, "Had error message ($e)");
+
+###----------------------------------------------------------------###
+
+### defer testing to the conf test modules
+foreach my $meth (qw(
+ conf_obj
+ conf_read
+ )) {
+ ok($cgix->can($meth), "Has method $meth");
+}
+
+###----------------------------------------------------------------###
+
+$form = {foo => 'bar'};
+my $args = {VARIABLES => {bim => 'bam'}};
+my $temp = "([% foo %])([% bim %])";
+
+$out = $cgix->swap_template($temp, $form, $args);
+ok($out =~ /bar/, "Got bar");
+ok($out =~ /bam/, "Got bam");
+
+$cgix->swap_template(\$temp, $form, $args);
+ok($temp =~ /bar/, "Got bar");
+ok($temp =~ /bam/, "Got bam");