File: new.t

package info (click to toggle)
libtest-www-mechanize-perl 1.20-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 200 kB
  • ctags: 39
  • sloc: perl: 1,489; makefile: 43
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, "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" );
}