File: pages-compat.t

package info (click to toggle)
libparse-mediawikidump-perl 0.40-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 116 kB
  • ctags: 58
  • sloc: perl: 782; xml: 80; makefile: 46; sql: 16
file content (32 lines) | stat: -rwxr-xr-x 769 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
31
32
#!perl -w

use Test::Simple tests => 22;
use strict;
use Parse::MediaWikiDump;

my $file = 'pages_test.xml';
my $fh;

test_all($file);

open($fh, $file) or die "could not open $file: $!";

test_all($fh);

sub test_all {
	my $pages = Parse::MediaWikiDump::Pages->new(shift);
	my $page = $pages->page;
	my $text = $page->text;

	ok($pages->sitename eq 'Sitename Test Value');
	ok($pages->base eq 'Base Test Value');
	ok($pages->generator eq 'Generator Test Value');
	ok($pages->case eq 'Case Test Value');
	ok($pages->namespaces->[0]->[0] == -2);
	ok($page->title eq 'Title Test Value');
	ok($page->id == 1);
	ok($page->timestamp eq '2005-07-09T18:41:10Z');
	ok($page->username eq 'Username Test Value');
	ok($page->userid == 1292);
	ok($$text eq "Text Test Value\n");
}