Index: trunk/tests/phpunit/tests/formatting/WPTexturize.php
===================================================================
--- trunk/tests/phpunit/tests/formatting/WPTexturize.php (revision 28726)
+++ trunk/tests/phpunit/tests/formatting/WPTexturize.php (revision 28727)
@@ -1129,3 +1129,154 @@
);
}
+
+ /**
+ * Test HTML and shortcode avoidance.
+ *
+ * @ticket 12690
+ * @dataProvider data_tag_avoidance
+ */
+ function test_tag_avoidance( $input, $output ) {
+ return $this->assertEquals( $output, wptexturize( $input ) );
+ }
+
+ function data_tag_avoidance() {
+ return array(
+ array(
+ '[ photos by this guy ]',
+ '[ photos by this guy ]',
+ ),
+ array(
+ '[gallery ...]',
+ '[gallery ...]',
+ ),
+ array(
+ '[[gallery ...]', // This tag is still valid.
+ '[[gallery ...]',
+ ),
+ array(
+ '[gallery ...]]', // This tag is also valid.
+ '[gallery ...]]',
+ ),
+ array(
+ '[/...]', // This would actually be ignored by the shortcode system. The decision to not texturize it is intentional, if not correct.
+ '[/...]',
+ ),
+ array(
+ '[...]...[/...]', // These are potentially usable shortcodes.
+ '[...]…[/...]',
+ ),
+ array(
+ '[[...]]...[[/...]]', // Shortcode parsing will ignore the inner ]...[ part and treat this as a single escaped shortcode.
+ '[[...]]…[[/...]]',
+ ),
+ array(
+ '[[[...]]]...[[[/...]]]', // Again, shortcode parsing matches, but only the [[...] and [/...]] parts.
+ '[[[...]]]…[[[/...]]]',
+ ),
+ array(
+ '[[code]...[/code]...', // These are potentially usable shortcodes. Unfortunately, the meaning of [[/code] is ambiguous unless we run the entire shortcode regexp.
+ '[[code]…[/code]...', // Same behavior as 3.9 due to buggy logic in _wptexturize_pushpop_element(). See ticket #28483.
+ ),
+ array(
+ '[code]...[/code]]...', // These are potentially usable shortcodes. Unfortunately, the meaning of [/code]] is ambiguous unless we run the entire shortcode regexp.
+ '[code]...[/code]]...', // This test would not pass in 3.9 because the extra brace was always ignored by texturize.
+ ),
+ array(
+ '[gal>ery ...]',
+ '[gal>ery …]',
+ ),
+ array(
+ '[gallery ...',
+ '[gallery …',
+ ),
+ array(
+ '[gallery
...]',
+ '[gallery
…]',
+ ),
+ array(
+ '
',
+ '
',
+ ),
+ array(
+ '
',
+ '
',
+ ),
+ array(
+ '
...
',
+ '
…
',
+ ),
+ array(
+ '[gallery ...]...[gallery ...]',
+ '[gallery ...]…[gallery ...]',
+ ),
+ array(
+ '[[gallery ...]]',
+ '[[gallery ...]]',
+ ),
+ array(
+ '[[gallery ...]',
+ '[[gallery ...]',
+ ),
+ array(
+ '[gallery ...]]',
+ '[gallery ...]]',
+ ),
+ array(
+ '[/gallery ...]]',
+ '[/gallery ...]]',
+ ),
+ array(
+ '[[gallery
...]]',
+ '[[gallery
…]]',
+ ),
+ array(
+ '
',
+ '
',
+ ),
+ array(
+ '
',
+ '',
+ ),
+ array(
+ '',
+ '',
+ ),
+ array(
+ '',
+ '',
+ ),
+ array(
+ '......',
+ '……',
+ ),
+ array(
+ '[gallery ...]......
',
+ '[gallery ...]……
',
+ ),
+ array(
+ '