WordPress.org

Make WordPress Core

Changeset 193 in tests


Ignore:
Timestamp:
04/01/2008 12:19:07 AM (10 years ago)
Author:
tellyworth
Message:

add tests for shortcode escaping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_shortcode.php

    r190 r193  
    132132    }
    133133   
     134    function test_tag_escaped() {
     135        $out = do_shortcode('[[footag]] [[bartag foo="bar"]]');
     136        $this->assertEquals('[footag] [bartag foo="bar"]', $out);
     137
     138        $out = do_shortcode('[[footag /]] [[bartag foo="bar" /]]');
     139        $this->assertEquals('[footag /] [bartag foo="bar" /]', $out);
     140       
     141        $out = do_shortcode('[[baztag foo="bar"]the content[/baztag]]');
     142        $this->assertEquals('[baztag foo="bar"]the content[/baztag]', $out);
     143    }
     144   
     145    function test_tag_not_escaped() {
     146        // these have square brackets on either end but aren't actually escaped
     147        $out = do_shortcode('[[footag] [bartag foo="bar"]]');
     148        $this->assertEquals('[foo =  foo = bar]', $out);
     149
     150        $out = do_shortcode('[[footag /] [bartag foo="bar" /]]');
     151        $this->assertEquals('[foo =  foo = bar]', $out);
     152
     153        $out = do_shortcode('[[baztag foo="bar"]the content[/baztag]');
     154        $this->assertEquals('[content = the content', $out);
     155       
     156        $out = do_shortcode('[[not-a-tag]]');
     157        $this->assertEquals('[[not-a-tag]]', $out);
     158    }
     159   
    134160    function test_mixed_tags() {
    135161        $in = <<<EOF
Note: See TracChangeset for help on using the changeset viewer.