File: 13escape-html.t

package info (click to toggle)
libhtml-widgets-navmenu-perl 1.1000-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 636 kB
  • sloc: perl: 8,051; makefile: 9
file content (35 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 8;

use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;

{
    # TEST
    is( escape_html("hello"), "hello", "Simple 1" );

    # TEST
    is( escape_html("hi\nYou  rule."), "hi\nYou  rule.", "Simple 2 with WS" );

    # TEST
    is( escape_html("D&D"), "D&D", "Ampersand" );

    # TEST
    is( escape_html("<b>Hello</b>"), "&lt;b&gt;Hello&lt;/b&gt;", "Tags" );

    # TEST
    is( escape_html("&amp;"), "&amp;amp;", "Double amp" );

    # TEST
    is( escape_html("&<hello>"), "&amp;&lt;hello&gt;", "Seq of 2" );

    # TEST
    is( escape_html(q{Hi "phony"}), q{Hi &quot;phony&quot;}, "Double quotes" );

    # TEST
    is( escape_html(q{"<&>"}), q{&quot;&lt;&amp;&gt;&quot;}, "All in one" );
}