#!/bin/env perl
BEGIN {
unless
(
grep
/blib/,
@INC
) {
chdir
't'
if
-d
't'
;
unshift
@INC
,
'../lib'
if
-d
'../lib'
;
}
}
BEGIN { plan
tests
=> 7 }
{
print
"'use Biblio::Citation::Parser...' test(s)...\n"
;
eval
"use Biblio::Citation::Parser 99.99"
;
ok($@ =~ /99\.99 required/);
}
{
my
$ref
=
"Jewell, M (2002) Making Examples for Reference Parsers. Journal of Example Writing 3:100-150."
;
my
$cit_parser
= new Biblio::Citation::Parser::Standard;
my
$metadata
=
$cit_parser
->parse(
$ref
);
ok(
scalar
keys
%$metadata
== 14);
ok(
$metadata
->{pages} eq
"100-150"
);
ok(
$metadata
->{title} eq
"Journal of Example Writing"
);
$metadata
->{foo} =
"bar"
;
$metadata
= trim_openurl(
$metadata
);
ok(!
$metadata
->{foo});
(
$metadata
,
undef
) = decompose_openurl(
$metadata
);
ok(
$metadata
->{spage} eq
"100"
);
}
{
my
$ref
=
"Jewell, M (2002) Making Examples for Reference Parsers. Journal of Example Writing 3:100-150."
;
my
$cit_parser
= new Biblio::Citation::Parser::Jiao;
my
$metadata
=
$cit_parser
->parse(
$ref
);
ok(
$metadata
->{spage} eq
"100"
);
}