summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t
blob: 4254f5c12f47caff33c90ff70d40afcd752e771e (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
#!/usr/bin/perl -w

use Test::More tests=>7;

use BibTeX::Parser;
use IO::File;


my $fh = new IO::File "t/bibs/01.bib", "r" ;

my $parser = new BibTeX::Parser $fh;




while (my $entry = $parser->next) {
    if($entry->key eq 'key01') {
	my $result1='@ARTICLE{key01,
    year = {1950},
    author = {Duck, Donald and Else, Someone},
    editor = {Itor, E. D. and Other, A. N.},
    title = {Title text},
    month = {January~1},
}';
	my $result2='@ARTICLE{key01,
    YEAR = {1950},
    AUTHOR = {Duck, Donald and Else, Someone},
    EDITOR = {Itor, E. D. and Other, A. N.},
    TITLE = {Title text},
    MONTH = {January~1},
}';
	my $result3='@ARTICLE{key01,
    Year = {1950},
    Author = {Duck, Donald and Else, Someone},
    Editor = {Itor, E. D. and Other, A. N.},
    Title = {Title text},
    Month = {January~1},
}';
	my $result4='@article{key01,
    year = {1950},
    author = {Duck, Donald and Else, Someone},
    editor = {Itor, E. D. and Other, A. N.},
    title = {Title text},
    month = {January~1},
}';
	my $result5='@Article{key01,
    year = {1950},
    author = {Duck, Donald and Else, Someone},
    editor = {Itor, E. D. and Other, A. N.},
    title = {Title text},
    month = {January~1},
}';
    is($entry->to_string,$result1);	
    is($entry->to_string(field_capitalization=>'Lowercase'),
			 $result1);	
    is($entry->to_string(field_capitalization=>'Uppercase'),
			 $result2);	
    is($entry->to_string(field_capitalization=>'Titlecase'),
			 $result3);	

    is($entry->to_string(type_capitalization=>'Lowercase'),
			 $result4);	
    is($entry->to_string(type_capitalization=>'Uppercase'),
			 $result1);	
    is($entry->to_string(type_capitalization=>'Titlecase'),
			 $result5);	
    }

}

done_testing();