WordPress.org

Make WordPress Core

Ticket #19308: 19308_unit_test.patch

File 19308_unit_test.patch, 1.3 KB (added by kurtpayne, 4 years ago)

Unit test wptexturize('AxB') for comma, decimal, and hex numbers

  • wp-testcase/test_includes_formatting.php

     
    452452                $this->assertEquals('14×24', wptexturize("14x24")); 
    453453        } 
    454454 
     455        // WP Ticket #19308 
     456        // Hex numbers of 0x1234 format should not be texturized as a "x [times] y" equation 
     457        function test_hex_numbers() { 
     458                $this->knownWPBug(19308); 
     459 
     460                // Hex numbers - these should display without a mathematical multiplaction sign 
     461                $this->assertEquals('0x70', wptexturize('0x70')); 
     462                $this->assertEquals('-0x70', wptexturize('-0x70')); 
     463                $this->assertEquals('0xABCDEF00', wptexturize('0xABCDEF00')); 
     464                $this->assertEquals('-0xABCDEF00', wptexturize('-0xABCDEF00')); 
     465                $this->assertEquals('0x3366ff', wptexturize('0x3366ff')); 
     466                 
     467                // Nonsense pattern, shouldn't be touched 
     468                $this->assertEquals('0x1x2x3', wptexturize('0x1x2x3')); 
     469 
     470                // Simple equations with a comma and negative operands 
     471                $this->assertEquals('-123×1=-123', wptexturize('-123x1=-123')); 
     472                $this->assertEquals('0.675×1=0.675', wptexturize('0.675x1=0.675')); 
     473        } 
     474         
    455475        function test_minutes_seconds() { 
    456476                $this->assertEquals('9′', wptexturize('9\'')); 
    457477                $this->assertEquals('9″', wptexturize("9\""));