File: 02-parser.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 (29 lines) | stat: -rwxr-xr-x 633 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

use strict;
use warnings;

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

my $tex = do { local $/; <DATA> };
my $texfile = File::Spec->catfile($Bin, 'data', 'tex.in');

my $parser = LaTeX::TOM->new(0,1,0);
my $tree_string = $parser->parse($tex);
my $tree_file = $parser->parseFile($texfile);

is_deeply($tree_string, $tree_file, 'Tree read from string equals tree read from file');

__DATA__
\NeedsTeXFormat{LaTeX2e}
\documentclass[11pt]{book}
\title{Some Test Doc}
\begin{document}
    \maketitle
    \mainmatter
    \chapter*{Preface}
    \input{t/data/input.tex}
\end{document}