Make WordPress Core


Ignore:
Timestamp:
06/16/2015 12:49:45 AM (10 years ago)
Author:
wonderboymusic
Message:

Improve the consistency of punctuation matching in wptexturize().

Adds unit tests.

Props miqrogroove.
Fixes #31886.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/WPTexturize.php

    r32788 r32789  
    113113        $this->assertEquals('Class of ’99’s', wptexturize("Class of '99's"));
    114114        $this->assertEquals('‘Class of ’99’', wptexturize("'Class of '99'"));
     115        $this->assertEquals('‘Class of ’99’ ', wptexturize("'Class of '99' "));
     116        $this->assertEquals('‘Class of ’99’.', wptexturize("'Class of '99'."));
     117        $this->assertEquals('‘Class of ’99’, she said', wptexturize("'Class of '99', she said"));
     118        $this->assertEquals('‘Class of ’99’:', wptexturize("'Class of '99':"));
     119        $this->assertEquals('‘Class of ’99’;', wptexturize("'Class of '99';"));
     120        $this->assertEquals('‘Class of ’99’!', wptexturize("'Class of '99'!"));
     121        $this->assertEquals('‘Class of ’99’?', wptexturize("'Class of '99'?"));
    115122        $this->assertEquals('‘Class of ’99’s’', wptexturize("'Class of '99's'"));
    116123        $this->assertEquals('‘Class of ’99’s’', wptexturize("'Class of '99’s'"));
     
    119126        $this->assertEquals('{“Class of ’99”}', wptexturize("{\"Class of '99\"}"));
    120127        $this->assertEquals(' “Class of ’99” ', wptexturize(" \"Class of '99\" "));
     128        $this->assertEquals(' “Class of ’99”.', wptexturize(" \"Class of '99\"."));
     129        $this->assertEquals(' “Class of ’99”, she said', wptexturize(" \"Class of '99\", she said"));
     130        $this->assertEquals(' “Class of ’99”:', wptexturize(" \"Class of '99\":"));
     131        $this->assertEquals(' “Class of ’99”;', wptexturize(" \"Class of '99\";"));
     132        $this->assertEquals(' “Class of ’99”!', wptexturize(" \"Class of '99\"!"));
     133        $this->assertEquals(' “Class of ’99”?', wptexturize(" \"Class of '99\"?"));
    121134        $this->assertEquals('}”Class of ’99″{', wptexturize("}\"Class of '99\"{")); // Not a quotation, may be between two other quotations.
    122135    }
     
    703716            ),
    704717            array(
     718                'test sentence",',
     719                'test sentence”,',
     720            ),
     721            array(
     722                'test sentence":',
     723                'test sentence”:',
     724            ),
     725            array(
     726                'test sentence";',
     727                'test sentence”;',
     728            ),
     729            array(
     730                'test sentence"!',
     731                'test sentence”!',
     732            ),
     733            array(
     734                'test sentence"?',
     735                'test sentence”?',
     736            ),
     737            array(
    705738                'test sentence."',
    706739                'test sentence.”',
     
    746779                "word word', she said",
    747780                "word word’, she said",
     781            ),
     782            array(
     783                "word word': word",
     784                "word word’: word",
     785            ),
     786            array(
     787                "word word'; word",
     788                "word word’; word",
     789            ),
     790            array(
     791                "word word'! word",
     792                "word word’! word",
     793            ),
     794            array(
     795                "word word'? word",
     796                "word word’? word",
    748797            ),
    749798            array(
Note: See TracChangeset for help on using the changeset viewer.