File: 02-parameterize.t

package info (click to toggle)
libwww-mechanize-treebuilder-perl 1.20000-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 1,418; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (6)
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
31
32
33
use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/../t/lib";

use Test::More tests => 9;

BEGIN { 
  use_ok 'WWW::Mechanize::TreeBuilder';
  use_ok 'MockMechanize';
};

my $mech = MockMechanize->new;

WWW::Mechanize::TreeBuilder->meta->apply(
  $mech, 
  tree_class => 'MockTreeBuilder'
);

can_ok($mech, "some_other_method" );
$mech->get_ok('/', 'Request ok');

# Check we can use normal TWMC methods
$mech->content_contains('A para');

ok($mech->has_tree, 'We have a HTML tree');

isa_ok($mech->tree, 'MockTreeBuilderEle');
is($mech->some_other_method, "I exist in MockTreeBuilderEle", "Delegated to subclass ok" );

is($mech->look_down(_tag => 'p')->as_trimmed_text, 'A para', "Got the right <p> out");