-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lthooks: new show related tests to fix issue #1243
- `lthooks-show-2020-10-01.lvt` is frozen at the 2020-10-01 release, no arguments in hooks - `update-lthooks-tests.sh` includes the above test - `lthooks-show.sty` is a library of test helpers. They will be used by forthcoming tests, as well as completed.
- Loading branch information
Showing
5 changed files
with
1,049 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
% This is a library of commands used by various `lthooks*.lvt` | ||
|
||
\IncludeInRelease{2020-10-01}{\TESTBlockHook}{Message} | ||
|
||
\def\DebugShowHookEnv#1{ | ||
\ShowHook{env/#1/before} | ||
\ShowHook{env/#1/begin} | ||
\ShowHook{env/#1/end} | ||
\ShowHook{env/#1/after} | ||
} | ||
|
||
\def\DebugShowHookCmd#1{ | ||
\ShowHook{cmd/#1/before} | ||
\ShowHook{cmd/#1/after} | ||
} | ||
|
||
\def\TESTBlockHookEnv#1#2{ | ||
% run at the top level | ||
% #1: the title of the block | ||
% #2: the name of the environment | ||
\BEGINTEST{Environment: #2} | ||
\DebugShowHookEnv{#2} | ||
\AddToHook{env/#2/before}{\TYPE{<#2 BEFORE>}} | ||
\AddToHook{env/#2/begin}{\TYPE{<#2 BEGIN>}} | ||
\AddToHook{env/#2/end}{\TYPE{<#2 END>}} | ||
\AddToHook{env/#2/after}{\TYPE{<#2 AFTER>}} | ||
\DebugShowHookEnv{#2} | ||
\ENDTEST | ||
} | ||
|
||
\def\TESTBlockHookCmd#1#2{ | ||
% run at the top level | ||
% #1: the title of the block | ||
% #2: the csname of the command | ||
\BEGINTEST{Command: #1} | ||
\DebugShowHookCmd{#2} | ||
\AddToHook{cmd/#2/before}{\TYPE{<#2 BEFORE>}} | ||
\AddToHook{cmd/#2/after}{\TYPE{<#2 AFTER>}} | ||
\DebugShowHookCmd{#2} | ||
\ENDTEST | ||
} | ||
\def\TESTBlockHookCustomGeneric#1#2{ | ||
% run at the top level | ||
% #1: the title of the block | ||
% #2: the name of the hook | ||
\BEGINTEST{Custom generic hook: #1} | ||
\def\TEST{ | ||
\UseHook{#2} | ||
\ShowHook{#2} | ||
} | ||
\BEGINTEST{Raw: #2} | ||
\AddToHook{#2}[LABEL]{\TYPE{<#2 CODE>}} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{Activated: #2} | ||
\ActivateGenericHook{#2} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{Disabled: #2} | ||
\DisableGenericHook{#2} | ||
\TEST | ||
\ENDTEST | ||
\ENDTEST | ||
} | ||
\def\TESTBlockHook#1#2{ | ||
% run at the top level | ||
% #1: the title of the block | ||
% #2: the name of the hook | ||
\BEGINTEST{#1} | ||
\def\TEST{ | ||
\UseHook{#2} | ||
\ShowHook{#2} | ||
} | ||
\BEGINTEST{Undeclared #2} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + TOP LEVEL} | ||
\AddToHook{#2}{\TYPE{<#2 TOP-LEVEL>}} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + A LABEL} | ||
\AddToHook{#2}[A LABEL]{\TYPE{<#2 A CODE>}} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + B LABEL} | ||
\AddToHook{#2}[B LABEL]{\TYPE{<#2 B CODE>}} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + C LABEL} | ||
\AddToHook{#2}[C LABEL]{\TYPE{<#2 C CODE>}} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + NEXT} | ||
\AddToHookNext{#2}{\TYPE{<NEXT-ONLY>}} | ||
\ShowHook{#2} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + C LABEL < A LABEL} | ||
\DeclareHookRule{#2}{C LABEL}{before}{A LABEL} | ||
\TEST | ||
\ENDTEST | ||
\BEGINTEST{#2 + DEFAULT: B LABEL > C LABEL} | ||
\DeclareDefaultHookRule{B LABEL}{after}{C LABEL} | ||
\TEST | ||
\ENDTEST | ||
\ENDTEST | ||
} | ||
\EndIncludeInRelease%{2020-10-01}{\TESTBlockHookOneArg}{Message} | ||
|
||
\IncludeInRelease{0000-00-00}{\whatever}{Message} | ||
\EndIncludeInRelease |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
% This is somehow `lthooks-show.lvt` frozen to the 2020-10-01 release | ||
% before hooks with arguments were introduced. | ||
|
||
\input{regression-test} | ||
\RequirePackage[2020-10-01]{latexrelease} | ||
\TYPE{********* RequirePackage[2020-10-01]{latexrelease}} | ||
|
||
\RequirePackage{./lthooks-show} | ||
|
||
\ExplSyntaxOn | ||
\debug_on:n { check-declarations , deprecation } | ||
\ExplSyntaxOff | ||
|
||
\documentclass{article} | ||
|
||
% There are many different hook profiles. | ||
|
||
\START | ||
|
||
\TESTBlockHookEnv | ||
{Undefined environment envA} | ||
{envA} | ||
\NewDocumentEnvironment | ||
{envA}{} | ||
{\TYPE{<BEGIN{envA}>}} | ||
{\TYPE{<END{envA}>}} | ||
\begin{envA}\TYPE{<envA BODY>}\end{envA} | ||
|
||
\NewDocumentEnvironment | ||
{envB}{} | ||
{\TYPE{<BEGIN{envB}>}} | ||
{\TYPE{<END{envB}>}} | ||
\TESTBlockHookEnv | ||
{Defined environment envB} | ||
{envB} | ||
\begin{envB}\TYPE{<envB BODY>}\end{envB} | ||
|
||
\TESTBlockHookCmd | ||
{Undefined command with no arguments} | ||
{cmdA} | ||
\NewDocumentCommand\cmdA{}{\TYPE{<cmdA BODY>}} | ||
\cmdA | ||
|
||
\NewDocumentCommand\cmdB{}{\TYPE{<cmdB BODY>}} | ||
\TESTBlockHookCmd | ||
{Defined command with no arguments} | ||
{cmdB} | ||
\cmdB | ||
|
||
\TESTBlockHookCustomGeneric | ||
{CUSTOM GENERIC HOOK} | ||
{CUSTOM GENERIC HOOK} | ||
|
||
\TESTBlockHook | ||
{OTHER HOOK: Undeclared} | ||
{UNDECLARED HOOK} | ||
|
||
\NewHook{DECLARED HOOK} | ||
|
||
\TESTBlockHook | ||
{OTHER HOOK: declared} | ||
{DECLARED HOOK} | ||
|
||
\NewReversedHook{DECLARED REVERSED} | ||
|
||
\TESTBlockHook | ||
{OTHER HOOK: declared reversed} | ||
{DECLARED REVERSED} | ||
|
||
\OMIT | ||
\begin{document} | ||
\TIMO | ||
|
||
\BEGINTEST{After \begin{document}} | ||
|
||
\BEGINTEST{Commands} | ||
\cmdA | ||
\SEPARATOR | ||
\cmdB | ||
\ENDTEST | ||
|
||
\ENDTEST | ||
|
||
\TYPE{!!!! If this test changes the documentation needs updating !!!!} | ||
|
||
\END |
Oops, something went wrong.