summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/bibtex/biber/t/06-labelname.t
blob: 7d59f54ed1e9760cc57390898157b165b0daedc4 (plain)
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
34
35
36
37
38
39
40
41
use strict;
use warnings;
use utf8;
no warnings 'utf8';

use Test::More tests => 3;

use Biber;
use Biber::Output::BBL;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($ERROR);
chdir("t/tdata");

# Set up Biber object
my $biber = Biber->new(noconf => 1);
Biber::Config->setoption('fastsort', 1);
$biber->parse_ctrlfile("general1.bcf");
$biber->set_output_obj(Biber::Output::BBL->new());

# Options - we could set these in the control file but it's nice to see what we're
# relying on here for tests

# Biblatex options
Biber::Config->setblxoption('labelnamespec', ['shortauthor', 'author', 'shorteditor', 'editor', 'translator']);
Biber::Config->setblxoption('labelnamespec', ['editor', 'translator'], 'PER_TYPE', 'book');

# Now generate the information
$biber->prepare;
my $bibentries = $biber->sections->get_section(0)->bibentries;

my $sa  = 'shortauthor';
my $a   = 'author';
my $ted = 'editor';


is($bibentries->entry('angenendtsa')->get_field('labelnamename'), $sa, 'global shortauthor' );
is($bibentries->entry('stdmodel')->get_field('labelnamename'), $a, 'global author' );
is($bibentries->entry('aristotle:anima')->get_field('labelnamename'), $ted, 'type-specific editor' );


unlink <*.utf8>;