Skip to content

Latest commit

 

History

History
150 lines (114 loc) · 3.43 KB

README.org

File metadata and controls

150 lines (114 loc) · 3.43 KB

tex4ht regression tests

Basics

A unit test consists of three main files:

  • tex file (test.tex), presaved results file (e.g., test.ss.html or test.ss.org, etc.), and Makefile

tex file test.tex

Minimal (non-)working example (MWE) test.tex file. Would be nice to have metadata:

  • author/date of a file
  • issue description
  • solution description
  • bug ID (?)
  • etc.

presaved results file test.ss.html (or test.ss.odt, test.ss.xml, etc.)

Pre-saved results file, which is compared against build results. Can be in various formats: html, xml, css, plain text, svg, binary (png)

build recipe in Makefile

Define rules:

  1. how to produce results (e.g., test.html file)
  2. how to compare results with pre-saved version (e.g., test.html vs test.ss.html)
  3. how to make pre-saved version (e.g., test.ss.html)

Common targets:

  1. %.html - generate results
  2. %.diff - generate diff file
  3. %.ss - presave file

Workflow:

  1. produce test.html; check against test.ss.html.
make check
  1. pre-save good copy when ready
make save
  1. remove unnecessary files
make clean

Setting new unit test

Run in shell:

make test=t-foo new

This will create three files:

  • ./tests/t-foo/Makefile
  • ./tests/t-foo/test.tex
  • ./tests/t-foo/test.ss.html (empty)

Change directory to ./tests/t-foo/. Put your LaTeX/TeX code in test.tex and amend metadata. Describe your issue. Put your command line in Makefile. Default is htlatex $<.

Run:

make check

It will create test.html (or other) file(s) and test.diff file. When you get correct results, issue command:

make save

which will pre-save your results (e.g., test.ss.html).

Issue

make clean

to clean up build files.

If you run again:

make check clean

you should get a SUCCESS message.

Leave test.ss.html file empty, if you are not able to get SUCCESS.

Checking a unit test

Change directory to a unit test folder ./tests/t-foo/. Run

make check

Checking the bundle (all tests)

To check all tests run

make check

at the top folder.

Your should get a summary report: (./build/summary.log)

      Summary
*******************
001	SUCCESS (t-172-oolatex-spaces).
002	SUCCESS (t-accents-combined).
003	SUCCESS (t-accents-xelatex).
004	SUCCESS (t-bmatrix).
005	FAILURE (t-hello). See ./build/t-hello/t-hello.diff
006	SUCCESS (t-lettrine).
007	SUCCESS (t-mathml-array).
008	SUCCESS (t-mwbk).
009	SUCCESS (t-scrartcl).
010	SUCCESS (t-scrbook-quoting).
011	SUCCESS (t-suits).

All files from /tests/t-* are copied to ./build folder and command make check is run recursively.

Folders with prefix t- are active tests. Folders with prefix xt- are invalid tests.

Template files

There are two template files:

  • _template.Makefile
  • _template.tex

Variables: FILE, TODAY

Dependencies: GNU M4 macro processor.

External dependencies

  • GNU make (version 4.1)
  • GNU M4 macro processor (version 1.4). Used for Makefile templates
  • pandoc (version 2.3.1). For standalone html file generation. see, e.g., t-suits, t-lettrine
  • make4ht (version v0.2b)