Skip to content

Commit

Permalink
better entity tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 23, 2012
1 parent 96a7282 commit a861330
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions t/mojo/bytestream.t
Expand Up @@ -211,8 +211,9 @@ $stream = b('foobar');
is $stream->html_unescape, 'foobar', 'right html unescaped result';

# html_unescape (relaxed)
$stream = b('f&0oo&nbspba;&ampr');
is $stream->html_unescape, "f&0oo\x{00a0}ba;&r", 'right html unescaped result';
$stream = b('&Ltf&amp&0oo&nbspba;&ltr');
is $stream->html_unescape, "&Ltf&&0oo\x{00a0}ba;<r",
'right html unescaped result';

# utf8 html_escape
$stream = b("foobar<baz>&\"\x{152}")->html_escape;
Expand Down
16 changes: 8 additions & 8 deletions t/mojo/dom.t
Expand Up @@ -1980,10 +1980,10 @@ is $dom->find('head > [http-equiv$="-type"]')->[1], undef, 'no result';
# Find "0" attribute value and unescape relaxed entity
$dom = Mojo::DOM->new(<<EOF);
<a accesskey="0">Zero</a>
<a accesskey="1">O&aMpn&ampe</a>
<a accesskey="1">O&gTn&gte</a>
EOF
is $dom->find('a[accesskey]')->[0]->text, 'Zero', 'right text';
is $dom->find('a[accesskey]')->[1]->text, 'O&aMpn&e', 'right text';
is $dom->find('a[accesskey]')->[0]->text, 'Zero', 'right text';
is $dom->find('a[accesskey]')->[1]->text, 'O&gTn>e', 'right text';
is $dom->find('a[accesskey]')->[2], undef, 'no result';
is $dom->find('a[accesskey="0"]')->[0]->text, 'Zero', 'right text';
is $dom->find('a[accesskey="0"]')->[1], undef, 'no result';
Expand All @@ -1995,15 +1995,15 @@ is $dom->find('a[accesskey~="0"]')->[0]->text, 'Zero', 'right text';
is $dom->find('a[accesskey~="0]')->[1], undef, 'no result';
is $dom->find('a[accesskey*="0"]')->[0]->text, 'Zero', 'right text';
is $dom->find('a[accesskey*="0]')->[1], undef, 'no result';
is $dom->find('a[accesskey="1"]')->[0]->text, 'O&aMpn&e', 'right text';
is $dom->find('a[accesskey="1"]')->[0]->text, 'O&gTn>e', 'right text';
is $dom->find('a[accesskey="1"]')->[1], undef, 'no result';
is $dom->find('a[accesskey^="1"]')->[0]->text, 'O&aMpn&e', 'right text';
is $dom->find('a[accesskey^="1"]')->[0]->text, 'O&gTn>e', 'right text';
is $dom->find('a[accesskey^="1"]')->[1], undef, 'no result';
is $dom->find('a[accesskey$="1"]')->[0]->text, 'O&aMpn&e', 'right text';
is $dom->find('a[accesskey$="1"]')->[0]->text, 'O&gTn>e', 'right text';
is $dom->find('a[accesskey$="1]')->[1], undef, 'no result';
is $dom->find('a[accesskey~="1"]')->[0]->text, 'O&aMpn&e', 'right text';
is $dom->find('a[accesskey~="1"]')->[0]->text, 'O&gTn>e', 'right text';
is $dom->find('a[accesskey~="1]')->[1], undef, 'no result';
is $dom->find('a[accesskey*="1"]')->[0]->text, 'O&aMpn&e', 'right text';
is $dom->find('a[accesskey*="1"]')->[0]->text, 'O&gTn>e', 'right text';
is $dom->find('a[accesskey*="1]')->[1], undef, 'no result';

# Empty attribute value
Expand Down

0 comments on commit a861330

Please sign in to comment.