Skip to content

Commit

Permalink
Update README and add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mouq committed Jan 26, 2015
1 parent e75dea6 commit 4a52cab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Can also encode basic entities via `&encode-entities`/`&encode`.

use HTML::Entity;

say encode-entities "This <em>needs</em> to be escaped & encoded!";
# This &lt;em&gt;needs&lt;/em&gt; to be escaped &amp; encoded!
say decode-entities "4.99 &approx; 5"; # 4.99 ≈ 5
say HTML::Entity<&nesim>.chrs; # ≂̸
say HTML::Entity<&nesim;> # ≂̸

use HTML::Entity :ALL;

Expand Down
13 changes: 0 additions & 13 deletions bin/generate_entity_hash.p6

This file was deleted.

17 changes: 17 additions & 0 deletions t/01-basic.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use HTML::Entity :ALL;
use Test;
plan 6;

is encode("This <em>needs</em> to be escaped & encoded!"),
"This &lt;em&gt;needs&lt;/em&gt; to be escaped &amp; encoded!",
"Basic encoding works";

is decode("4.99 &approx; 5"), "4.99 ≈ 5",
"Basic decoding works";

is HTML::Entity<&nesim;>, "≂̸", "Can look up entities";

is encode(""), "&#8482;", "Can encode (appropriate) characters > 127";

is decode("fj&aumlril"), "fjäril", "Decoding works for entities that don't require semicolons";
is decode("&nbsp; &gt; &nbsp&lt;&nbump;"), "  >  <≎̸", "Decoding multiple entities is fine";

0 comments on commit 4a52cab

Please sign in to comment.