obj = new HTMLPurifier_ChildDef_Custom('(a,b?,c*,d+,(a,b)*)');
$this->assertEqual($this->obj->elements, array('a' => true,
'b' => true, 'c' => true, 'd' => true));
$this->assertResult('', false);
$this->assertResult('', false);
$this->assertResult('');
$this->assertResult('Dobfoo'.
'foo');
}
function testNesting() {
$this->obj = new HTMLPurifier_ChildDef_Custom('(a,b,(c|d))+');
$this->assertEqual($this->obj->elements, array('a' => true,
'b' => true, 'c' => true, 'd' => true));
$this->assertResult('', false);
$this->assertResult('');
$this->assertResult('', false);
}
function testNestedEitherOr() {
$this->obj = new HTMLPurifier_ChildDef_Custom('b,(a|(c|d))+');
$this->assertEqual($this->obj->elements, array('a' => true,
'b' => true, 'c' => true, 'd' => true));
$this->assertResult('', false);
$this->assertResult('');
$this->assertResult('');
$this->assertResult('');
$this->assertResult('', false);
}
function testNestedQuantifier() {
$this->obj = new HTMLPurifier_ChildDef_Custom('(b,c+)*');
$this->assertEqual($this->obj->elements, array('b' => true, 'c' => true));
$this->assertResult('');
$this->assertResult('');
$this->assertResult('');
$this->assertResult('');
$this->assertResult('', false);
}
function testEitherOr() {
$this->obj = new HTMLPurifier_ChildDef_Custom('a|b');
$this->assertEqual($this->obj->elements, array('a' => true, 'b' => true));
$this->assertResult('', false);
$this->assertResult('');
$this->assertResult('');
$this->assertResult('', false);
}
function testCommafication() {
$this->obj = new HTMLPurifier_ChildDef_Custom('a,b');
$this->assertEqual($this->obj->elements, array('a' => true, 'b' => true));
$this->assertResult('');
$this->assertResult(' ', false);
}
function testPcdata() {
$this->obj = new HTMLPurifier_ChildDef_Custom('#PCDATA,a');
$this->assertEqual($this->obj->elements, array('#PCDATA' => true, 'a' => true));
$this->assertResult('foo');
$this->assertResult('', false);
}
function testWhitespace() {
$this->obj = new HTMLPurifier_ChildDef_Custom('a');
$this->assertEqual($this->obj->elements, array('a' => true));
$this->assertResult('foo', false);
$this->assertResult('');
$this->assertResult(' ');
}
}
// vim: et sw=4 sts=4