summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/bibtex/biber/t/11-set-static.t
blob: c014c4bb1d0f3731db253bf02c0fbbad138405c1 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
use strict;
use warnings;
use utf8;
no warnings 'utf8';

use Test::More tests => 5;

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->parse_ctrlfile('set-static.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

# Biber options
Biber::Config->setoption('fastsort', 1);

# Now generate the information
$biber->prepare;
my $section = $biber->sections->get_section(0);
my $main = $section->get_list('MAIN');
my $out = $biber->get_output_obj;

my $string1 = q|  \entry{Static1}{set}{}
    \set{Static2,Static3,Static4}
    \name{labelname}{1}{%
      {{Bumble}{B.}{Brian}{B.}{}{}{}{}}%
    }
    \name{author}{1}{%
      {{Bumble}{B.}{Brian}{B.}{}{}{}{}}%
    }
    \strng{namehash}{BB1}
    \strng{fullhash}{BB1}
    \field{sortinit}{0}
    \field{labelyear}{2001}
    \field{annotation}{Some notes}
    \field{title}{Blessed Brains}
    \field{year}{2001}
  \endentry

|;

my $string2 = q|  \entry{Static2}{book}{}
    \inset{Static1}
    \name{labelname}{1}{%
      {{Bumble}{B.}{Brian}{B.}{}{}{}{}}%
    }
    \name{author}{1}{%
      {{Bumble}{B.}{Brian}{B.}{}{}{}{}}%
    }
    \strng{namehash}{BB1}
    \strng{fullhash}{BB1}
    \field{sortinit}{0}
    \field{annotation}{Some Blessed Note}
    \field{title}{Blessed Brains}
    \field{year}{2001}
  \endentry

|;

my $string3 = q|  \entry{Static3}{book}{}
    \inset{Static1}
    \name{labelname}{1}{%
      {{Crenellation}{C.}{Clive}{C.}{}{}{}{}}%
    }
    \name{author}{1}{%
      {{Crenellation}{C.}{Clive}{C.}{}{}{}{}}%
    }
    \strng{namehash}{CC1}
    \strng{fullhash}{CC1}
    \field{sortinit}{0}
    \field{title}{Castles and Crime}
    \field{year}{2002}
  \endentry

|;

my $string4 = q|  \entry{Static4}{book}{}
    \inset{Static1}
    \name{labelname}{1}{%
      {{Dingle}{D.}{Derek}{D.}{}{}{}{}}%
    }
    \name{author}{1}{%
      {{Dingle}{D.}{Derek}{D.}{}{}{}{}}%
    }
    \strng{namehash}{DD1}
    \strng{fullhash}{DD1}
    \field{sortinit}{0}
    \field{title}{Dungeons, Dark and Dangerous}
    \field{year}{2005}
  \endentry

|;

# Labelyear is now here as skiplab is not set for this entry when cited in section
# without citation of a set it is a member of
my $string5 = q|  \entry{Static2}{book}{}
    \name{labelname}{1}{%
      {{Bumble}{B.}{Brian}{B.}{}{}{}{}}%
    }
    \name{author}{1}{%
      {{Bumble}{B.}{Brian}{B.}{}{}{}{}}%
    }
    \strng{namehash}{BB1}
    \strng{fullhash}{BB1}
    \field{sortinit}{0}
    \field{labelyear}{2001}
    \field{annotation}{Some Blessed Note}
    \field{title}{Blessed Brains}
    \field{year}{2001}
  \endentry

|;


is($out->get_output_entry($main,'Static1'), $string1, 'Static set test 1');
is($out->get_output_entry($main,'Static2'), $string2, 'Static set test 2');
is($out->get_output_entry($main,'Static3'), $string3, 'Static set test 3');
is($out->get_output_entry($main,'Static4'), $string4, 'Static set test 4');
is($out->get_output_entry($main,'Static2', 1), $string5, 'Static set test 5');

unlink <*.utf8>;