File: mapping.t

package info (click to toggle)
liblatex-tom-perl 1.06-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 1,787; makefile: 2
file content (33 lines) | stat: -rwxr-xr-x 731 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl

use strict;
use warnings;

use File::Spec;
use FindBin qw($Bin);
use LaTeX::TOM;
use Test::More tests => 1;

my $abs_path = File::Spec->catfile($Bin, 'data', 'mapping.t');

my $parser = LaTeX::TOM->new(0,0,1);

my $tex = do { local $/; <DATA> };

my $tree_string = $parser->parse($tex);
my $tree_file   = $parser->parseFile(File::Spec->catfile($abs_path, 'mapping.in'));

is_deeply(
    [ grep /\S/, split /\n/, $tree_string->toLaTeX ],
    [ grep /\S/, split /\n/, $tree_file->toLaTeX   ],
'mapping');

__DATA__
\documentclass[10pt]{article}
\newenvironment{centered}{\begin{center}}{\end{center}}
\newcommand{\bold}[1]{{\bf #1}}
\begin{document}
\begin{centered}
foo \bold{bar} baz
\end{centered}
\end{document}