File: new.t

package info (click to toggle)
libtest-www-mechanize-perl 1.30-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 252 kB
  • ctags: 52
  • sloc: perl: 1,617; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 771 bytes parent folder | download
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
#!perl

use warnings;
use strict;
use Test::More tests => 7;

BEGIN {
    use_ok( 'Test::WWW::Mechanize' );
}

NEW: {
    my $m = Test::WWW::Mechanize->new;
    isa_ok( $m, 'Test::WWW::Mechanize' );
}

# Stolen from WWW::Mechanize's t/new.t.
# If this works, then subclassing works OK.
CONSTRUCTOR_PARMS: {
    my $alias = 'Windows IE 6';
    my $m = Test::WWW::Mechanize->new( agent => $alias );
    isa_ok( $m, 'Test::WWW::Mechanize' );
    can_ok( $m, 'request' );
    is( $m->agent, $alias, q{Aliases don't get translated in the constructor} );

    $m->agent_alias( $alias );
    like( $m->agent, qr/^Mozilla.+compatible.+Windows/, 'Alias sets the agent' );

    $m->agent( 'ratso/bongo v.43' );
    is( $m->agent, 'ratso/bongo v.43', 'Can still set the agent' );
}