Skip to content

Commit

Permalink
Add regression tests for fancyref option
Browse files Browse the repository at this point in the history
  • Loading branch information
gusbrs committed May 5, 2024
1 parent 746745c commit 81f9aa8
Show file tree
Hide file tree
Showing 2 changed files with 221 additions and 0 deletions.
125 changes: 125 additions & 0 deletions testfiles/zc-label-fancyref01.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
\documentclass{book}

\input{regression-test}

\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation }
\ExplSyntaxOff

\newcommand{\testtmp}{}
\ExplSyntaxOn
\cs_new_protected:Npn \my_tl_show_if_exist:n #1
{ \tl_if_exist:cT {#1} { \tl_show:c {#1} } }
\NewDocumentCommand{\myshowaux}{m}{ \my_tl_show_if_exist:n {#1} }
\ExplSyntaxOff

\usepackage[english]{babel}

\usepackage{zref-clever}
\usepackage{zref-check}
\usepackage{zref-titleref}

\usepackage{hyperref}

% This file is intended to test the fancyref and related options.

\begin{document}

\textsuperscript{avoid font warning}

% Just a bogus counter which will not interact with any of the types of
% interest.
\newcounter{myfoobarcounter}
\refstepcounter{myfoobarcounter}

\START

\BEGINTEST{Option: fancyref=...}
\zcsetup{fancyref}
\label{chap:foo-1-1}
\label{foo-1-2}
\label{cha:foo-1-3}
\label{sec:foo-1-4}
\zcsetup{fancyref=false}
\label{chap:foo-1-5}
\label{sec:foo-1-6}
\myshowaux{Z@R@chap:foo-1-1}
\myshowaux{Z@R@foo-1-2}
\myshowaux{Z@R@cha:foo-1-3}
\myshowaux{Z@R@sec:foo-1-4}
\myshowaux{Z@R@chap:foo-1-5}
\myshowaux{Z@R@sec:foo-1-6}
\ENDTEST

% Enable it globally for remaining tests.
\zcsetup{fancyref=true}

\BEGINTEST{Option: fancyrefdelim=...}
\zcsetup{fancyrefdelim={::}}
\label{chap::foo-2-1}
\label{chap:foo-2-2}
\zcsetup{fancyrefdelim={<!bar!>}}
\label{chap<!bar!>foo-2-3}
\label{sec:foo-2-4}
\myshowaux{Z@R@chap::foo-2-1}
\myshowaux{Z@R@chap:foo-2-2}
\myshowaux{Z@R@chap<!bar!>foo-2-3}
\myshowaux{Z@R@sec:foo-2-4}
\ENDTEST

\BEGINTEST{Option: fancyrefprefix=...}
% initial value
\label{chap:foo-3-1}
\label{sec:foo-3-2}
\label{eq:foo-3-3}
\label{fig:foo-3-4}
\label{tab:foo-3-5}
\label{enum:foo-3-6}
\label{fn:foo-3-7}
% some which do not exist
\label{thm:foo-3-8}
\label{cha:foo-3-9}
% but now we create them
\zcsetup{fancyrefprefix={thm=theorem,cha=chapter}}
\label{thm:foo-3-10}
\label{cha:foo-3-11}
% remove some of the initial ones
\zcsetup{fancyrefprefix={chap=,sec=}}
\label{chap:foo-3-12}
\label{sec:foo-3-13}
\myshowaux{Z@R@chap:foo-3-1}
\myshowaux{Z@R@sec:foo-3-2}
\myshowaux{Z@R@eq:foo-3-3}
\myshowaux{Z@R@fig:foo-3-4}
\myshowaux{Z@R@tab:foo-3-5}
\myshowaux{Z@R@enum:foo-3-6}
\myshowaux{Z@R@fn:foo-3-7}
\myshowaux{Z@R@thm:foo-3-8}
\myshowaux{Z@R@cha:foo-3-9}
\myshowaux{Z@R@thm:foo-3-10}
\myshowaux{Z@R@cha:foo-3-11}
\myshowaux{Z@R@chap:foo-3-12}
\myshowaux{Z@R@sec:foo-3-13}
\ENDTEST

\BEGINTEST{Options interactions}
\begingroup
\zcsetup{fancyref=false,countertype={myfoobarcounter=myfoobartype}}
\label{chap:foo-4-1}
\endgroup
\begingroup
\zcsetup{fancyref=true,countertype={myfoobarcounter=myfoobartype}}
\label{chap:foo-4-2}
\endgroup
\begingroup
\zcsetup{reftype=mybarbaztype}
\label{chap:foo-4-3}
\endgroup
\myshowaux{Z@R@chap:foo-4-1}
\myshowaux{Z@R@chap:foo-4-2}
\myshowaux{Z@R@chap:foo-4-3}
\ENDTEST

\OMIT

\end{document}
96 changes: 96 additions & 0 deletions testfiles/zc-label-fancyref01.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: Option: fancyref=...
============================================================
> \Z@R@chap:foo-1-1=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {chapter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-1-1}
> \Z@R@foo-1-2=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@foo-1-2}
> \Z@R@cha:foo-1-3=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@cha:foo-1-3}
> \Z@R@sec:foo-1-4=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {section}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@sec:foo-1-4}
> \Z@R@chap:foo-1-5=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-1-5}
> \Z@R@sec:foo-1-6=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@sec:foo-1-6}
============================================================
============================================================
TEST 2: Option: fancyrefdelim=...
============================================================
> \Z@R@chap::foo-2-1=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {chapter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap::foo-2-1}
> \Z@R@chap:foo-2-2=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-2-2}
> \Z@R@chap<!bar!>foo-2-3=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {chapter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap<!bar!>foo-2-3}
> \Z@R@sec:foo-2-4=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@sec:foo-2-4}
============================================================
============================================================
TEST 3: Option: fancyrefprefix=...
============================================================
> \Z@R@chap:foo-3-1=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {chapter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-3-1}
> \Z@R@sec:foo-3-2=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {section}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@sec:foo-3-2}
> \Z@R@eq:foo-3-3=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {equation}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@eq:foo-3-3}
> \Z@R@fig:foo-3-4=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {figure}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@fig:foo-3-4}
> \Z@R@tab:foo-3-5=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {table}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@tab:foo-3-5}
> \Z@R@enum:foo-3-6=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {item}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@enum:foo-3-6}
> \Z@R@fn:foo-3-7=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {footnote}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@fn:foo-3-7}
> \Z@R@thm:foo-3-8=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@thm:foo-3-8}
> \Z@R@cha:foo-3-9=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@cha:foo-3-9}
> \Z@R@thm:foo-3-10=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {theorem}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@thm:foo-3-10}
> \Z@R@cha:foo-3-11=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {chapter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@cha:foo-3-11}
> \Z@R@chap:foo-3-12=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-3-12}
> \Z@R@sec:foo-3-13=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobarcounter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@sec:foo-3-13}
============================================================
============================================================
TEST 4: Options interactions
============================================================
> \Z@R@chap:foo-4-1=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {myfoobartype}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-4-1}
> \Z@R@chap:foo-4-2=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {chapter}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-4-2}
> \Z@R@chap:foo-4-3=\default {1}\page {1}\abspage {1}\zc@counter {myfoobarcounter}\thecounter {1}\zc@type {mybarbaztype}\zc@cntval {1}\zc@pgval {1}\zc@enclval {}\zc@pgfmt {1}\zc@abschap {0}\zc@abssec {0}\title {}\anchor {myfoobarcounter.1}.
<recently read> }
l. ...\myshowaux{Z@R@chap:foo-4-3}
============================================================

0 comments on commit 81f9aa8

Please sign in to comment.