X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=unit_tests%2Fformat.php;h=92644181a66b62e1a528262505f831a9400be026;hb=f920d084acbf8c53c996a6fee26530a41e7e0559;hp=0869a7eb79158076b6b09069e2bc9142b7205b17;hpb=58634c046869454b074417a80cf5e35761ec9e8e;p=wfpl.git diff --git a/unit_tests/format.php b/unit_tests/format.php index 0869a7e..9264418 100644 --- a/unit_tests/format.php +++ b/unit_tests/format.php @@ -183,47 +183,9 @@ function test_format_misc() { format_12hr_to_hours($str) format_phone($str) */ - - return $errors; -} - -# returns number of errors -function _test_format_options($field, $value, $correct) { - $ret = format_options($value, $field); - if($ret !== $correct) { - message("format_options($value, $field) returned \"$ret\" instead of \"$correct\""); - return 1; - } - return 0; } - -function test_format_options() { - $errors = 0; - pulldown('array', array('one', 'two', "symbols&'\""), PULLDOWN_ARRAY); - $errors +=_test_format_options('array', 'one', 'one'); - $errors +=_test_format_options('array', 'One', ''); - $errors +=_test_format_options('array', 'two', 'two'); - $errors +=_test_format_options('array', 'symbols&\'"', 'symbols&\'"'); - pulldown('hash', array('one' => 'Eno', 'two' => 'Owt', 'symbols&\'"' => 'Slobmys'), PULLDOWN_HASH); - $errors +=_test_format_options('hash', 'one', 'one'); - $errors +=_test_format_options('hash', 'One', ''); - $errors +=_test_format_options('hash', 'two', 'two'); - $errors +=_test_format_options('hash', 'symbols&\'"', ''); - pulldown('array_2d', array(array('one', 'Eno'), array('two', 'Owt'), array('symbols&\'"', 'Slobmys')), PULLDOWN_2D); - $errors +=_test_format_options('array_2d', 'one', 'one'); - $errors +=_test_format_options('array_2d', 'One', ''); - $errors +=_test_format_options('array_2d', 'two', 'two'); - $errors +=_test_format_options('array_2d', 'symbols&\'"', ''); - - return $errors; -} - -# returns number of errors function format_unit_tests_main() { - $errors = 0; - $errors += test_format_money(); - $errors += test_format_misc(); - $errors += test_format_options(); - return $errors; + test_format_money(); + test_format_misc(); }