summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/cweb-latex/src/test/newif.w
blob: 53ae2775145daa440f0e28624cb331d94a81195f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% $Id: newif.w,v 1.1 1995/11/07 18:28:52 schrod Exp $
%------------------------------------------------------------

% test that proper definition of \newif is established.


% First, restore problematic definition and pretend we're an old LaTeX.

\makeatletter

\outer\def\newif#1{\count@@\escapechar \escapechar\m@@ne
  \expandafter\expandafter\expandafter
   \edef\@@if#1{true}{\let\noexpand#1=\noexpand\iftrue}%
  \expandafter\expandafter\expandafter
   \edef\@@if#1{false}{\let\noexpand#1=\noexpand\iffalse}%
  \@@if#1{false}\escapechar\count@@} % the condition starts out false

\let\OldNewif=\newif

\edef\fmtversion{1994/12/01}

\makeatother


% Now, start the document and check if \newif got redefined.

\documentclass{cweb}

\begin{document}

\ifx \OldNewif\newif
    \errmessage{\string\newif\space was not redefined.}
\else
    \message{\string\newif\space got redefined.}
\fi

@ Test.

\end{document}