Skip to content

Commit

Permalink
Environment version of \TEST (fixes #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jun 30, 2017
1 parent 2020307 commit f66433d
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions l3build.dtx
Expand Up @@ -776,6 +776,9 @@
% \cs{TESTEXP} surrounds its contents with \cs{TYPE} and formatting to match \cs{TEST}; this can be used as a shorthand to test expandable commands.
% \item
% TODO: would a \cs{TESTFEXP} command (based on \cs{romannumeral} expansion) be useful as well?
% \item
% \cs{BEGINTEST}\marg{title} \dots \cs{ENDTEST} is an environment form of
% \cs{TEST}, allowing verbatim material, \emph{etc.} to appear.
% \end{itemize}
% An example of some of these commands is shown following.
% \begin{Verbatim}
Expand Down Expand Up @@ -1503,7 +1506,18 @@
% \end{macro}
%
% \begin{macro}
% {\SEPARATOR, \TEST, \TESTEXP, \TRUE, \FALSE, \YES, \NO, \NEWLINE}
% {
% \SEPARATOR,
% \BEGINTEST,
% \ENDTEST,
% \TEST,
% \TESTEXP,
% \TRUE,
% \FALSE,
% \YES,
% \NO,
% \NEWLINE
% }
% We are not starved for space in the log file output, so let's make it as
% verbose as is useful when reading the |.diff|'s.
% \begin{macrocode}
Expand All @@ -1512,30 +1526,29 @@
============================================================%
}%
}
\long\def\TEST#1#2{%
\protected\long\def\BEGINTEST#1{%
\global\advance\gTESTint by 1 %
\SEPARATOR
\LONGTYPEOUT{TEST \the\gTESTint: \detokenize{#1}}%
\SEPARATOR
\begingroup
\let\TYPE\LONGTYPEOUT
#2%

}
\protected\long\def\ENDTEST{%
\endgroup
\SEPARATOR
\LONGTYPEOUT{}%
}
\long\def\TEST#1#2{%
\BEGINTEST{#1}%
#2%
\ENDTEST
}
\long\def\TESTEXP#1#2{%
\global\advance\gTESTint by 1 %
\SEPARATOR
\LONGTYPEOUT{%
TEST \the\gTESTint: \detokenize{#1}}%
\SEPARATOR
\begingroup
\long\def\TYPE##1{##1}%
\LONGTYPEOUT{#2}%
\endgroup
\SEPARATOR
\LONGTYPEOUT{}%
\BEGINTEST{#1}%
\LONGTYPEOUT{#2}%
\ENDTEST
}
\def \TRUE {\TYPE{TRUE}}
\def \FALSE {\TYPE{FALSE}}
Expand Down

0 comments on commit f66433d

Please sign in to comment.