Debian Codegraph @

t/headers-etag.t

raw
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 plan tests => 11;
7
8 require HTTP::Headers::ETag;
9
10 my $h = HTTP::Headers->new;
11
12 $h->etag("tag1");
13 is($h->etag, qq("tag1"));
14
15 $h->etag("w/tag2");
16 is($h->etag, qq(W/"tag2"));
17
18 $h->etag(" w/, weaktag");
19 is($h->etag, qq(W/"", "weaktag"));
20 my @list = $h->etag;
21 is_deeply(\@list, ['W/""', '"weaktag"']);
22
23 $h->etag(" w/");
24 is($h->etag, qq(W/""));
25
26 $h->etag(" ");
27 is($h->etag, "");
28
29 $h->if_match(qq(W/"foo", bar, baz), "bar");
30 $h->if_none_match(333);
31
32 $h->if_range("tag3");
33 is($h->if_range, qq("tag3"));
34
35 my $t = time;
36 $h->if_range($t);
37 is($h->if_range, $t);
38
39 note $h->as_string;
40
41 @list = $h->if_range;
42 is($#list, 0);
43 is($list[0], $t);
44 $h->if_range(undef);
45 is($h->if_range, '');