summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t
blob: 90b87eba14c476f6324cdafe59a5fde1e91a2a65 (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
#!/usr/bin/perl -w

use Test::More tests => 7;

use BibTeX::Parser;

my %strings = ();

$_ = 1234;
parse_ok("parse digit string");

$_ = '"simple double quoted string"';
parse_is("simple double quoted string", "- double quoted string");

$_ = '"double quotes { with embeded } brackets"';
parse_is("double quotes { with embeded } brackets", "- with embeded brackets");

$_ = '"string 1 " # "string 2"';
parse_is("string 1 string 2", "- concatenation");

$strings{test}  = "string";
$strings{other} = "text";

$_ = "test";
parse_is("string", "- string variable");

$_ = "test # other";
parse_is("stringtext", "- concatenation of string variables");

$_ = '"M{\"{u}}nchen"';
parse_is('M{\"{u}}nchen', "- escaped quote");

sub parse_ok {
	is(BibTeX::Parser::_parse_string(\%strings), $_, shift);
}

sub parse_is {
	is(BibTeX::Parser::_parse_string(\%strings), shift, shift);
}