Skip to content

Commit

Permalink
Add test file showing the wrong behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
PhelypeOleinik committed Oct 21, 2021
1 parent 645514b commit 64ae62e
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
41 changes: 41 additions & 0 deletions base/testfiles-lthooks/github-0697.lvt
@@ -0,0 +1,41 @@

\RequirePackage[enable-debug]{expl3}
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation }
\ExplSyntaxOff

\input{test2e}

% case 1: no parameter (hashes don't matter)
\DeclareRobustCommand\fooA{\typeout{##}}

% case 2: parameters and no hashes
\DeclareRobustCommand\fooB[1]{\typeout{#1}}

% case 2: parameters and with hashes
\DeclareRobustCommand\fooC[1]{\typeout{#1/##2}}

\AddToHook{cmd/fooA/before}{\typeout{fooA}}
\AddToHook{cmd/fooB/before}{\typeout{fooB}}
\AddToHook{cmd/fooC/before}{\typeout{fooC}}

% check command with unbalanced conditionals in its replacement text:
\DeclareRobustCommand\barA[1]{\typeout{#1/##2/\string\if\string\if\string\if}}
\DeclareRobustCommand\barB[1]{\typeout{#1/##2/\string\fi\string\fi\string\fi}}

\AddToHook{cmd/barA/before}{\typeout{barA}}
\AddToHook{cmd/barB/before}{\typeout{barB}}

\START

\ExplSyntaxOn
\__hook_cmd_begindocument_code:
\ExplSyntaxOff

\fooA
\fooB{X}
\fooC{X}
\barA{X}
\barB{X}

\END
40 changes: 40 additions & 0 deletions base/testfiles-lthooks/github-0697.tlg
@@ -0,0 +1,40 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
! Illegal parameter number in definition of \fooA .
<to be read again>
}
l. ...\__hook_cmd_begindocument_code:
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \fooC .
<to be read again>
2
l. ...\__hook_cmd_begindocument_code:
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \barA .
<to be read again>
2
l. ...\__hook_cmd_begindocument_code:
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \barB .
<to be read again>
2
l. ...\__hook_cmd_begindocument_code:
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
fooA
##
fooB
X
fooC
X/##2
barA
X/##2/\if\if\if
barB
X/##2/\fi\fi\fi

0 comments on commit 64ae62e

Please sign in to comment.