| | 197 | |
| | 198 | /** |
| | 199 | * @ticket 22692 |
| | 200 | */ |
| | 201 | function test_spaces_around_quotes() { |
| | 202 | $nbsp = "\xC2\xA0"; |
| | 203 | $pi = "\xCE\xA0"; |
| | 204 | |
| | 205 | // This should never happen, even if the desired output changes some day. |
| | 206 | |
| | 207 | $problem_input = "$nbsp\"A"; |
| | 208 | $problem_output = "$nbsp”A"; |
| | 209 | |
| | 210 | $this->assertNotEquals( $problem_output, wptexturize( $problem_input ) ); |
| | 211 | |
| | 212 | // These are desirable outputs for the current design. |
| | 213 | |
| | 214 | $input = array(); |
| | 215 | $output = array(); |
| | 216 | |
| | 217 | $input[] = "stop. $nbsp\"A quote after 2 spaces.\""; |
| | 218 | $output[] = "stop. $nbsp“A quote after 2 spaces.”"; |
| | 219 | |
| | 220 | $input[] = "stop.$nbsp$nbsp\"A quote after 2 spaces.\""; |
| | 221 | $output[] = "stop.$nbsp$nbsp“A quote after 2 spaces.”"; |
| | 222 | |
| | 223 | $input[] = "stop. $nbsp'A quote after 2 spaces.'"; |
| | 224 | $output[] = "stop. $nbsp‘A quote after 2 spaces.’"; |
| | 225 | |
| | 226 | $input[] = "stop.$nbsp$nbsp'A quote after 2 spaces.'"; |
| | 227 | $output[] = "stop.$nbsp$nbsp‘A quote after 2 spaces.’"; |
| | 228 | |
| | 229 | $input[] = "stop. \"A quote after 2 spaces.\""; |
| | 230 | $output[] = "stop. “A quote after 2 spaces.”"; |
| | 231 | |
| | 232 | $input[] = "stop. \"A quote after 2 spaces.\""; |
| | 233 | $output[] = "stop. “A quote after 2 spaces.”"; |
| | 234 | |
| | 235 | $input[] = "stop. 'A quote after 2 spaces.'"; |
| | 236 | $output[] = "stop. ‘A quote after 2 spaces.’"; |
| | 237 | |
| | 238 | $input[] = "stop. 'A quote after 2 spaces.'"; |
| | 239 | $output[] = "stop. ‘A quote after 2 spaces.’"; |
| | 240 | |
| | 241 | $input[] = "Contraction: $pi's"; |
| | 242 | $output[] = "Contraction: $pi’s"; |
| | 243 | |
| | 244 | foreach($input as $key => $in) { |
| | 245 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 246 | } |
| | 247 | } |