This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Module-CoreList is 2.92 on CPAN
[perl5.git] / cpan / HTTP-Tiny / t / 003_agent.t
CommitLineData
d72a6fbd
CBW
1#!perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 3;
7use HTTP::Tiny;
8
9# a couple tests to ensure that we get the default agent expected, the coorect
10# agent when specified, and the correct agent when specifified with a space at
11# the end of the string (as LWP::UserAgent does)
12
13
14my $default = 'HTTP-Tiny/' . (HTTP::Tiny->VERSION || 0);
15
16{
17 my $ua = HTTP::Tiny->new();
18 is $ua->agent, $default, 'default agent string is as expected';
19}
20
21{
22 my $ua = HTTP::Tiny->new(agent => 'something else');
23 is $ua->agent, 'something else', 'agent string is as expected';
24}
25
26{
27 my $ua = HTTP::Tiny->new(agent => 'something else ');
28 is
29 $ua->agent,
30 "something else $default",
31 'agent string is as properly appended to',
32 ;
33}