| | 200 | |
| | 201 | /** |
| | 202 | * @ticket 22692 |
| | 203 | */ |
| | 204 | function test_spaces_around_quotes() { |
| | 205 | $nbsp = "\xC2\xA0"; |
| | 206 | $pi = "\xCE\xA0"; |
| | 207 | |
| | 208 | // This should never happen, even if the desired output changes some day. |
| | 209 | |
| | 210 | $problem_input = "$nbsp\"A"; |
| | 211 | $problem_output = "$nbsp”A"; |
| | 212 | |
| | 213 | $this->assertNotEquals( $problem_output, wptexturize( $problem_input ) ); |
| | 214 | |
| | 215 | // These are desirable outputs for the current design. |
| | 216 | |
| | 217 | $input = array(); |
| | 218 | $output = array(); |
| | 219 | |
| | 220 | $input[] = "stop. $nbsp\"A quote after 2 spaces.\""; |
| | 221 | $output[] = "stop. $nbsp“A quote after 2 spaces.”"; |
| | 222 | |
| | 223 | $input[] = "stop.$nbsp$nbsp\"A quote after 2 spaces.\""; |
| | 224 | $output[] = "stop.$nbsp$nbsp“A quote after 2 spaces.”"; |
| | 225 | |
| | 226 | $input[] = "stop. $nbsp'A quote after 2 spaces.'"; |
| | 227 | $output[] = "stop. $nbsp‘A quote after 2 spaces.’"; |
| | 228 | |
| | 229 | $input[] = "stop.$nbsp$nbsp'A quote after 2 spaces.'"; |
| | 230 | $output[] = "stop.$nbsp$nbsp‘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[] = "stop. 'A quote after 2 spaces.'"; |
| | 242 | $output[] = "stop. ‘A quote after 2 spaces.’"; |
| | 243 | |
| | 244 | $input[] = "Contraction: $pi's"; |
| | 245 | $output[] = "Contraction: $pi’s"; |
| | 246 | |
| | 247 | foreach($input as $key => $in) { |
| | 248 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 249 | } |
| | 250 | } |
| | 251 | |
| | 252 | /** |
| | 253 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 254 | * |
| | 255 | * @ticket 22692 |
| | 256 | */ |
| | 257 | function test_apos_before_digits() { |
| | 258 | $input = array(); |
| | 259 | $output = array(); |
| | 260 | |
| | 261 | // Apostrophe before a number always becomes ’ (apos); |
| | 262 | |
| | 263 | $input[] = "word '99 word"; |
| | 264 | $output[] = "word ’99 word"; |
| | 265 | |
| | 266 | $input[] = "word'99 word"; |
| | 267 | $output[] = "word’99 word"; |
| | 268 | |
| | 269 | $input[] = "word '99word"; |
| | 270 | $output[] = "word ’99word"; |
| | 271 | |
| | 272 | $input[] = "word'99word"; |
| | 273 | $output[] = "word’99word"; |
| | 274 | |
| | 275 | $input[] = "word '99’s word"; // Appears as a separate but logically superfluous pattern in 3.8. |
| | 276 | $output[] = "word ’99’s word"; |
| | 277 | |
| | 278 | $input[] = "word '99's word"; // Due to the logic error, second apos becomes a prime. See ticket #22823 |
| | 279 | $output[] = "word ’99′s word"; |
| | 280 | |
| | 281 | $input[] = "word '99'samsonite"; |
| | 282 | $output[] = "word ’99′samsonite"; |
| | 283 | |
| | 284 | $input[] = "according to our source, '33% of all students scored less than 50' on the test."; // Apostrophes and primes have priority over quotes |
| | 285 | $output[] = "according to our source, ’33% of all students scored less than 50′ on the test."; |
| | 286 | |
| | 287 | $input[] = "word '99' word"; // See ticket #8775 |
| | 288 | $output[] = "word ’99′ word"; |
| | 289 | |
| | 290 | foreach($input as $key => $in) { |
| | 291 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 292 | } |
| | 293 | } |
| | 294 | |
| | 295 | /** |
| | 296 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 297 | * |
| | 298 | * @ticket 22692 |
| | 299 | */ |
| | 300 | function test_opening_single_quote() { |
| | 301 | $input = array(); |
| | 302 | $output = array(); |
| | 303 | |
| | 304 | // Apostrophe after a space or ([{<" becomes ‘ (opening_single_quote) |
| | 305 | |
| | 306 | $input[] = "word 'word word"; |
| | 307 | $output[] = "word ‘word word"; |
| | 308 | |
| | 309 | $input[] = "word ('word word"; |
| | 310 | $output[] = "word (‘word word"; |
| | 311 | |
| | 312 | $input[] = "word ['word word"; |
| | 313 | $output[] = "word [‘word word"; |
| | 314 | |
| | 315 | $input[] = "word <'word word"; // Invalid HTML input? |
| | 316 | $output[] = "word <‘word word"; |
| | 317 | |
| | 318 | $input[] = "word <'word word"; // Valid HTML input triggers the apos in a word pattern |
| | 319 | $output[] = "word <’word word"; |
| | 320 | |
| | 321 | $input[] = "word {'word word"; |
| | 322 | $output[] = "word {‘word word"; |
| | 323 | |
| | 324 | $input[] = "word \"'word word"; |
| | 325 | $output[] = "word “‘word word"; // Two opening quotes |
| | 326 | |
| | 327 | $input[] = "'word word"; |
| | 328 | $output[] = "‘word word"; |
| | 329 | |
| | 330 | $input[] = "word('word word"; |
| | 331 | $output[] = "word(‘word word"; |
| | 332 | |
| | 333 | $input[] = "word['word word"; |
| | 334 | $output[] = "word[‘word word"; |
| | 335 | |
| | 336 | $input[] = "word<'word word"; |
| | 337 | $output[] = "word<‘word word"; |
| | 338 | |
| | 339 | $input[] = "word<'word word"; |
| | 340 | $output[] = "word<’word word"; |
| | 341 | |
| | 342 | $input[] = "word{'word word"; |
| | 343 | $output[] = "word{‘word word"; |
| | 344 | |
| | 345 | $input[] = "word\"'word word"; |
| | 346 | $output[] = "word”‘word word"; // Closing quote, then opening quote |
| | 347 | |
| | 348 | $input[] = "word ' word word"; |
| | 349 | $output[] = "word ‘ word word"; |
| | 350 | |
| | 351 | $input[] = "word (' word word"; |
| | 352 | $output[] = "word (‘ word word"; |
| | 353 | |
| | 354 | $input[] = "word [' word word"; |
| | 355 | $output[] = "word [‘ word word"; |
| | 356 | |
| | 357 | $input[] = "word <' word word"; // Invalid HTML input? |
| | 358 | $output[] = "word <‘ word word"; |
| | 359 | |
| | 360 | $input[] = "word <' word word"; // Valid HTML input triggers the closing single quote here |
| | 361 | $output[] = "word <’ word word"; |
| | 362 | |
| | 363 | $input[] = "word {' word word"; |
| | 364 | $output[] = "word {‘ word word"; |
| | 365 | |
| | 366 | $input[] = "word \"' word word"; |
| | 367 | $output[] = "word “‘ word word"; // Two opening quotes |
| | 368 | |
| | 369 | $input[] = "' word word"; |
| | 370 | $output[] = "‘ word word"; |
| | 371 | |
| | 372 | $input[] = "word(' word word"; |
| | 373 | $output[] = "word(‘ word word"; |
| | 374 | |
| | 375 | $input[] = "word[' word word"; |
| | 376 | $output[] = "word[‘ word word"; |
| | 377 | |
| | 378 | $input[] = "word<' word word"; |
| | 379 | $output[] = "word<‘ word word"; |
| | 380 | |
| | 381 | $input[] = "word<' word word"; |
| | 382 | $output[] = "word<’ word word"; |
| | 383 | |
| | 384 | $input[] = "word{' word word"; |
| | 385 | $output[] = "word{‘ word word"; |
| | 386 | |
| | 387 | $input[] = "word\"' word word"; |
| | 388 | $output[] = "word”‘ word word"; // Closing quote, then opening quote |
| | 389 | |
| | 390 | foreach($input as $key => $in) { |
| | 391 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 392 | } |
| | 393 | } |
| | 394 | |
| | 395 | /** |
| | 396 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 397 | * |
| | 398 | * @ticket 22692 |
| | 399 | */ |
| | 400 | function test_double_prime() { |
| | 401 | $input = array(); |
| | 402 | $output = array(); |
| | 403 | |
| | 404 | // Double quote after a number becomes ″ (double_prime) |
| | 405 | |
| | 406 | $input[] = 'word 99" word'; |
| | 407 | $output[] = 'word 99″ word'; |
| | 408 | |
| | 409 | $input[] = 'word 99"word'; |
| | 410 | $output[] = 'word 99″word'; |
| | 411 | |
| | 412 | $input[] = 'word99" word'; |
| | 413 | $output[] = 'word99″ word'; |
| | 414 | |
| | 415 | $input[] = 'word99"word'; |
| | 416 | $output[] = 'word99″word'; |
| | 417 | |
| | 418 | foreach($input as $key => $in) { |
| | 419 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 420 | } |
| | 421 | } |
| | 422 | |
| | 423 | /** |
| | 424 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 425 | * |
| | 426 | * @ticket 22692 |
| | 427 | */ |
| | 428 | function test_single_prime() { |
| | 429 | $input = array(); |
| | 430 | $output = array(); |
| | 431 | |
| | 432 | // Apostrophe after a number becomes ′ (prime) |
| | 433 | |
| | 434 | $input[] = "word 99' word"; |
| | 435 | $output[] = "word 99′ word"; |
| | 436 | |
| | 437 | $input[] = "word 99'word"; |
| | 438 | $output[] = "word 99′word"; |
| | 439 | |
| | 440 | $input[] = "word99' word"; |
| | 441 | $output[] = "word99′ word"; |
| | 442 | |
| | 443 | $input[] = "word99'word"; |
| | 444 | $output[] = "word99′word"; |
| | 445 | |
| | 446 | foreach($input as $key => $in) { |
| | 447 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 448 | } |
| | 449 | } |
| | 450 | |
| | 451 | /** |
| | 452 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 453 | * |
| | 454 | * @ticket 22692 |
| | 455 | */ |
| | 456 | function test_contractions() { |
| | 457 | $input = array(); |
| | 458 | $output = array(); |
| | 459 | |
| | 460 | // Apostrophe "in a word" becomes ’ (apos) |
| | 461 | |
| | 462 | $input[] = "word word's word"; |
| | 463 | $output[] = "word word’s word"; |
| | 464 | |
| | 465 | $input[] = "word word'. word"; // Quotes with outside punctuation could end with apostrophes instead of closing quotes (may affect i18n) |
| | 466 | $output[] = "word word’. word"; |
| | 467 | |
| | 468 | $input[] = "word ]'. word"; |
| | 469 | $output[] = "word ]’. word"; |
| | 470 | |
| | 471 | $input[] = "word )'. word"; |
| | 472 | $output[] = "word )’. word"; |
| | 473 | |
| | 474 | $input[] = "word }'. word"; |
| | 475 | $output[] = "word }’. word"; |
| | 476 | |
| | 477 | $input[] = "word >'. word"; // Not tested |
| | 478 | $output[] = "word >’. word"; |
| | 479 | |
| | 480 | $input[] = "word >'. word"; |
| | 481 | $output[] = "word >’. word"; |
| | 482 | |
| | 483 | foreach($input as $key => $in) { |
| | 484 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 485 | } |
| | 486 | } |
| | 487 | |
| | 488 | /** |
| | 489 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 490 | * |
| | 491 | * @ticket 22692 |
| | 492 | */ |
| | 493 | function test_opening_quote() { |
| | 494 | $input = array(); |
| | 495 | $output = array(); |
| | 496 | |
| | 497 | // Double quote after a space or ([{< becomes “ (opening_quote) if not followed by spaces |
| | 498 | |
| | 499 | $input[] = 'word "word word'; |
| | 500 | $output[] = 'word “word word'; |
| | 501 | |
| | 502 | $input[] = 'word ("word word'; |
| | 503 | $output[] = 'word (“word word'; |
| | 504 | |
| | 505 | $input[] = 'word ["word word'; |
| | 506 | $output[] = 'word [“word word'; |
| | 507 | |
| | 508 | $input[] = 'word <"word word'; // Invalid HTML input? |
| | 509 | $output[] = 'word <“word word'; |
| | 510 | |
| | 511 | $input[] = 'word <"word word'; // Valid HTML input triggers the closing quote pattern |
| | 512 | $output[] = 'word <”word word'; |
| | 513 | |
| | 514 | $input[] = 'word {"word word'; |
| | 515 | $output[] = 'word {“word word'; |
| | 516 | |
| | 517 | $input[] = '"word word'; |
| | 518 | $output[] = '“word word'; |
| | 519 | |
| | 520 | $input[] = 'word("word word'; |
| | 521 | $output[] = 'word(“word word'; |
| | 522 | |
| | 523 | $input[] = 'word["word word'; |
| | 524 | $output[] = 'word[“word word'; |
| | 525 | |
| | 526 | $input[] = 'word<"word word'; // Invalid HTML input? |
| | 527 | $output[] = 'word<“word word'; |
| | 528 | |
| | 529 | $input[] = 'word<"word word'; // Valid HTML input triggers the closing quote pattern |
| | 530 | $output[] = 'word<”word word'; |
| | 531 | |
| | 532 | $input[] = 'word{"word word'; |
| | 533 | $output[] = 'word{“word word'; |
| | 534 | |
| | 535 | $input[] = 'word "99 word'; |
| | 536 | $output[] = 'word “99 word'; |
| | 537 | |
| | 538 | foreach($input as $key => $in) { |
| | 539 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 540 | } |
| | 541 | } |
| | 542 | |
| | 543 | /** |
| | 544 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 545 | * |
| | 546 | * @ticket 22692 |
| | 547 | */ |
| | 548 | function test_closing_quote() { |
| | 549 | $input = array(); |
| | 550 | $output = array(); |
| | 551 | |
| | 552 | // Double quote becomes ” (closing_quote) unless it is already converted to double_prime or opening_quote. |
| | 553 | |
| | 554 | $input[] = 'word word" word'; |
| | 555 | $output[] = 'word word” word'; |
| | 556 | |
| | 557 | $input[] = 'word word") word'; |
| | 558 | $output[] = 'word word”) word'; |
| | 559 | |
| | 560 | $input[] = 'word word"] word'; |
| | 561 | $output[] = 'word word”] word'; |
| | 562 | |
| | 563 | $input[] = 'word word"} word'; |
| | 564 | $output[] = 'word word”} word'; |
| | 565 | |
| | 566 | $input[] = 'word word"> word'; // Invalid HTML input? |
| | 567 | $output[] = 'word word”> word'; |
| | 568 | |
| | 569 | $input[] = 'word word"> word'; // Valid HTML should work |
| | 570 | $output[] = 'word word”> word'; |
| | 571 | |
| | 572 | $input[] = 'word word"'; |
| | 573 | $output[] = 'word word”'; |
| | 574 | |
| | 575 | $input[] = 'word word"word'; |
| | 576 | $output[] = 'word word”word'; |
| | 577 | |
| | 578 | $input[] = 'word"word"word'; |
| | 579 | $output[] = 'word”word”word'; |
| | 580 | |
| | 581 | $input[] = 'test sentence".'; |
| | 582 | $output[] = 'test sentence”.'; |
| | 583 | |
| | 584 | $input[] = 'test sentence."'; |
| | 585 | $output[] = 'test sentence.”'; |
| | 586 | |
| | 587 | $input[] = 'test sentence". word'; |
| | 588 | $output[] = 'test sentence”. word'; |
| | 589 | |
| | 590 | $input[] = 'test sentence." word'; |
| | 591 | $output[] = 'test sentence.” word'; |
| | 592 | |
| | 593 | foreach($input as $key => $in) { |
| | 594 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 595 | } |
| | 596 | } |
| | 597 | |
| | 598 | /** |
| | 599 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 600 | * |
| | 601 | * @ticket 22692 |
| | 602 | */ |
| | 603 | function test_closing_single_quote() { |
| | 604 | $input = array(); |
| | 605 | $output = array(); |
| | 606 | |
| | 607 | // Single quote followed by a space or a period becomes ’ (closing_single_quote) |
| | 608 | |
| | 609 | $input[] = "word word' word"; |
| | 610 | $output[] = "word word’ word"; |
| | 611 | |
| | 612 | $input[] = "word word'. word"; |
| | 613 | $output[] = "word word’. word"; |
| | 614 | |
| | 615 | $input[] = "word word'.word"; |
| | 616 | $output[] = "word word’.word"; |
| | 617 | |
| | 618 | $input[] = "word word'"; |
| | 619 | $output[] = "word word’"; |
| | 620 | |
| | 621 | $input[] = "test sentence'."; |
| | 622 | $output[] = "test sentence’."; |
| | 623 | |
| | 624 | $input[] = "test sentence.'"; |
| | 625 | $output[] = "test sentence.’"; |
| | 626 | |
| | 627 | $input[] = "test sentence'. word"; |
| | 628 | $output[] = "test sentence’. word"; |
| | 629 | |
| | 630 | $input[] = "test sentence.' word"; |
| | 631 | $output[] = "test sentence.’ word"; |
| | 632 | |
| | 633 | foreach($input as $key => $in) { |
| | 634 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 635 | } |
| | 636 | } |
| | 637 | |
| | 638 | /** |
| | 639 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 640 | * |
| | 641 | * @ticket 22692 |
| | 642 | */ |
| | 643 | function test_multiplication() { |
| | 644 | $input = array(); |
| | 645 | $output = array(); |
| | 646 | |
| | 647 | // 9x9 becomes 9×9 |
| | 648 | |
| | 649 | $input[] = "9x9"; |
| | 650 | $output[] = "9×9"; |
| | 651 | |
| | 652 | $input[] = "12x34"; |
| | 653 | $output[] = "12×34"; |
| | 654 | |
| | 655 | $input[] = "9 x 9"; |
| | 656 | $output[] = "9 x 9"; |
| | 657 | |
| | 658 | foreach($input as $key => $in) { |
| | 659 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 660 | } |
| | 661 | } |
| | 662 | |
| | 663 | /** |
| | 664 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 665 | * |
| | 666 | * @ticket 22692 |
| | 667 | */ |
| | 668 | function test_ampersand() { |
| | 669 | $input = array(); |
| | 670 | $output = array(); |
| | 671 | |
| | 672 | // & always becomes & unless it is followed by # or ; |
| | 673 | |
| | 674 | $input[] = "word & word"; |
| | 675 | $output[] = "word & word"; |
| | 676 | |
| | 677 | $input[] = "word&word"; |
| | 678 | $output[] = "word&word"; |
| | 679 | |
| | 680 | $input[] = "word word"; |
| | 681 | $output[] = "word word"; |
| | 682 | |
| | 683 | $input[] = "word & word"; |
| | 684 | $output[] = "word & word"; |
| | 685 | |
| | 686 | $input[] = "word &# word"; |
| | 687 | $output[] = "word &# word"; // invalid output? |
| | 688 | |
| | 689 | $input[] = "word &44; word"; |
| | 690 | $output[] = "word &44; word"; |
| | 691 | |
| | 692 | foreach($input as $key => $in) { |
| | 693 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 694 | } |
| | 695 | } |
| | 696 | |
| | 697 | /** |
| | 698 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 699 | * |
| | 700 | * @ticket 22692 |
| | 701 | */ |
| | 702 | function test_cockney() { |
| | 703 | $input = array(); |
| | 704 | $output = array(); |
| | 705 | |
| | 706 | // "cockney" phrases begin with apos instead of opening_single_quote. |
| | 707 | |
| | 708 | $input[] = "word 'tain't word"; |
| | 709 | $output[] = "word ’tain’t word"; |
| | 710 | |
| | 711 | $input[] = "word 'twere word"; |
| | 712 | $output[] = "word ’twere word"; |
| | 713 | |
| | 714 | $input[] = "word 'twas word"; |
| | 715 | $output[] = "word ’twas word"; |
| | 716 | |
| | 717 | $input[] = "word 'tis word"; |
| | 718 | $output[] = "word ’tis word"; |
| | 719 | |
| | 720 | $input[] = "word 'twill word"; |
| | 721 | $output[] = "word ’twill word"; |
| | 722 | |
| | 723 | $input[] = "word 'til word"; |
| | 724 | $output[] = "word ’til word"; |
| | 725 | |
| | 726 | $input[] = "word 'bout word"; |
| | 727 | $output[] = "word ’bout word"; |
| | 728 | |
| | 729 | $input[] = "word 'nuff word"; |
| | 730 | $output[] = "word ’nuff word"; |
| | 731 | |
| | 732 | $input[] = "word 'round word"; |
| | 733 | $output[] = "word ’round word"; |
| | 734 | |
| | 735 | $input[] = "word 'cause word"; |
| | 736 | $output[] = "word ’cause word"; |
| | 737 | |
| | 738 | $input[] = "word 'em word"; |
| | 739 | $output[] = "word ‘em word"; |
| | 740 | |
| | 741 | foreach($input as $key => $in) { |
| | 742 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 743 | } |
| | 744 | } |
| | 745 | |
| | 746 | /** |
| | 747 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 748 | * |
| | 749 | * @ticket 22692 |
| | 750 | */ |
| | 751 | function test_smart_dashes() { |
| | 752 | $input = array(); |
| | 753 | $output = array(); |
| | 754 | |
| | 755 | // Smart dashes, etc |
| | 756 | |
| | 757 | $input[] = "word --- word"; |
| | 758 | $output[] = "word — word"; |
| | 759 | |
| | 760 | $input[] = "word---word"; |
| | 761 | $output[] = "word—word"; |
| | 762 | |
| | 763 | $input[] = "word -- word"; |
| | 764 | $output[] = "word — word"; |
| | 765 | |
| | 766 | $input[] = "word--word"; |
| | 767 | $output[] = "word–word"; |
| | 768 | |
| | 769 | $input[] = "word - word"; |
| | 770 | $output[] = "word – word"; |
| | 771 | |
| | 772 | $input[] = "word-word"; |
| | 773 | $output[] = "word-word"; |
| | 774 | |
| | 775 | $input[] = "word xn– word"; |
| | 776 | $output[] = "word xn-- word"; |
| | 777 | |
| | 778 | $input[] = "wordxn–word"; |
| | 779 | $output[] = "wordxn--word"; |
| | 780 | |
| | 781 | foreach($input as $key => $in) { |
| | 782 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 783 | } |
| | 784 | } |
| | 785 | |
| | 786 | /** |
| | 787 | * Check all baseline patterns. If anything ever changes in wptexturize(), these tests may fail. |
| | 788 | * |
| | 789 | * @ticket 22692 |
| | 790 | */ |
| | 791 | function test_misc_static_replacements() { |
| | 792 | $input = array(); |
| | 793 | $output = array(); |
| | 794 | |
| | 795 | $input[] = "word ... word"; |
| | 796 | $output[] = "word … word"; |
| | 797 | |
| | 798 | $input[] = "word...word"; |
| | 799 | $output[] = "word…word"; |
| | 800 | |
| | 801 | $input[] = "word `` word"; |
| | 802 | $output[] = "word “ word"; |
| | 803 | |
| | 804 | $input[] = "word``word"; |
| | 805 | $output[] = "word“word"; |
| | 806 | |
| | 807 | $input[] = "word '' word"; |
| | 808 | $output[] = "word ” word"; |
| | 809 | |
| | 810 | $input[] = "word''word"; |
| | 811 | $output[] = "word”word"; |
| | 812 | |
| | 813 | $input[] = "word (tm) word"; |
| | 814 | $output[] = "word ™ word"; |
| | 815 | |
| | 816 | $input[] = "word (tm)word"; |
| | 817 | $output[] = "word ™word"; |
| | 818 | |
| | 819 | $input[] = "word(tm) word"; |
| | 820 | $output[] = "word(tm) word"; |
| | 821 | |
| | 822 | $input[] = "word(tm)word"; |
| | 823 | $output[] = "word(tm)word"; |
| | 824 | |
| | 825 | foreach($input as $key => $in) { |
| | 826 | $this->assertEquals( $output[$key], wptexturize( $in ) ); |
| | 827 | } |
| | 828 | } |