File: 08__uri.t

package info (click to toggle)
libpetal-utils-perl 0.06-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 384 kB
  • sloc: perl: 935; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (3)
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
36
37
#!/usr/bin/perl

##
## Tests for Petal::Utils :uri modifiers
##

use strict;
#use warnings;

use Test::More qw( no_plan );

use Carp;
use t::LoadPetal;

use Petal::Utils qw( :uri );

my $hash = {
	and    => 'this&that',
	space  => 'this that',
	comma  => 'this,that',
	scolon => 'this;that',
	slash  => 'this/that',
	qmark  => 'this?that',
	dot    => 'this.that',
};
my $template = Petal->new('uri.html');
my $out      = $template->process( $hash );

# UriEscape
like($out, qr/this\%26that/, '&');
like($out, qr/this\%20that/, "' '");
like($out, qr/this\%2Cthat/, ',');
like($out, qr/this\%3Bthat/, ';');
like($out, qr/this\%2Fthat/, '/');
like($out, qr/this\%3Fthat/, '?');
like($out, qr/this\.that/,   '.');
# that's enough proof for me.