| Revision 20119,
1.6 KB
checked in by nanasess, 15 years ago
(diff) |
|
module 以下は svn:keywords を除外
|
-
Property svn:eol-style set to
LF
|
| Line | |
|---|
| 1 | --TEST-- |
|---|
| 2 | Function -- idate |
|---|
| 3 | --SKIPIF-- |
|---|
| 4 | <?php if (function_exists('idate')) { echo 'skip'; } ?> |
|---|
| 5 | --FILE-- |
|---|
| 6 | <?php |
|---|
| 7 | require_once 'PHP/Compat.php'; |
|---|
| 8 | PHP_Compat::loadFunction('idate'); |
|---|
| 9 | |
|---|
| 10 | $tests = array( |
|---|
| 11 | 'B', // OK |
|---|
| 12 | 'd', // ... |
|---|
| 13 | 'h', |
|---|
| 14 | 'H', |
|---|
| 15 | 'i', |
|---|
| 16 | 'I', |
|---|
| 17 | 'L', |
|---|
| 18 | 'm', |
|---|
| 19 | 's', |
|---|
| 20 | 't', |
|---|
| 21 | 'U', |
|---|
| 22 | 'w', |
|---|
| 23 | 'W', |
|---|
| 24 | 'y', |
|---|
| 25 | 'Y', |
|---|
| 26 | 'z', // ... |
|---|
| 27 | 'Z', // OK |
|---|
| 28 | |
|---|
| 29 | 'foo', // NOK |
|---|
| 30 | '', // NOK |
|---|
| 31 | '!', // NOK |
|---|
| 32 | '\\' // NOK |
|---|
| 33 | ); |
|---|
| 34 | |
|---|
| 35 | function ehandler($no, $str) |
|---|
| 36 | { |
|---|
| 37 | echo '(Warning) '; |
|---|
| 38 | } |
|---|
| 39 | set_error_handler('ehandler'); |
|---|
| 40 | |
|---|
| 41 | foreach ($tests as $v) { |
|---|
| 42 | echo 'testing: '; |
|---|
| 43 | var_dump($v); |
|---|
| 44 | echo "\nresult: "; |
|---|
| 45 | $res = idate($v); |
|---|
| 46 | if (!$res) { |
|---|
| 47 | var_dump($res); |
|---|
| 48 | } else { |
|---|
| 49 | echo "> 0\n"; |
|---|
| 50 | } |
|---|
| 51 | echo "\n\n"; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | restore_error_handler(); |
|---|
| 55 | ?> |
|---|
| 56 | --EXPECT-- |
|---|
| 57 | testing: string(1) "B" |
|---|
| 58 | |
|---|
| 59 | result: > 0 |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | testing: string(1) "d" |
|---|
| 63 | |
|---|
| 64 | result: > 0 |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | testing: string(1) "h" |
|---|
| 68 | |
|---|
| 69 | result: > 0 |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | testing: string(1) "H" |
|---|
| 73 | |
|---|
| 74 | result: > 0 |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | testing: string(1) "i" |
|---|
| 78 | |
|---|
| 79 | result: > 0 |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | testing: string(1) "I" |
|---|
| 83 | |
|---|
| 84 | result: int(0) |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | testing: string(1) "L" |
|---|
| 88 | |
|---|
| 89 | result: int(0) |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | testing: string(1) "m" |
|---|
| 93 | |
|---|
| 94 | result: > 0 |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | testing: string(1) "s" |
|---|
| 98 | |
|---|
| 99 | result: > 0 |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | testing: string(1) "t" |
|---|
| 103 | |
|---|
| 104 | result: > 0 |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | testing: string(1) "U" |
|---|
| 108 | |
|---|
| 109 | result: > 0 |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | testing: string(1) "w" |
|---|
| 113 | |
|---|
| 114 | result: > 0 |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | testing: string(1) "W" |
|---|
| 118 | |
|---|
| 119 | result: > 0 |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | testing: string(1) "y" |
|---|
| 123 | |
|---|
| 124 | result: > 0 |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | testing: string(1) "Y" |
|---|
| 128 | |
|---|
| 129 | result: > 0 |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | testing: string(1) "z" |
|---|
| 133 | |
|---|
| 134 | result: > 0 |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | testing: string(1) "Z" |
|---|
| 138 | |
|---|
| 139 | result: int(0) |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | testing: string(3) "foo" |
|---|
| 143 | |
|---|
| 144 | result: (Warning) bool(false) |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | testing: string(0) "" |
|---|
| 148 | |
|---|
| 149 | result: (Warning) bool(false) |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | testing: string(1) "!" |
|---|
| 153 | |
|---|
| 154 | result: int(0) |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | testing: string(1) "\" |
|---|
| 158 | |
|---|
| 159 | result: int(0) |
|---|
Note: See
TracBrowser
for help on using the repository browser.