File: 08_clone.t

package info (click to toggle)
liburi-query-perl 0.16-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 196 kB
  • sloc: perl: 227; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 702 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
# Test URI::Query clone()

use strict;
use vars q($count);

use Test::More;

use_ok('URI::Query');

my $qq;

ok($qq = URI::Query->new('foo=1&foo=2&bar=3;bog=abc;bar=7;fluffy=3'), "constructor ok");
my $str1 = $qq->stringify;
my $qstr = $qq->qstringify;
is($qstr, "?$str1", "qstringify ok: $qstr");

# Basic clone test
is($qq->clone->stringify, $str1, 'unchanged clone stringifies identically');

# Clone and make a change
isnt($qq->clone->strip('fluffy')->stringify, $qq->stringify, 'changed clone stringifies differently');

# Identical changes stringify identically
is($qq->clone->strip('fluffy')->qstringify, $qq->strip('fluffy')->qstringify, 'same changes qstringify identically');

done_testing;