summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/oberdiek/test/infwarerr-test2.tex
blob: a150713f78b25af7de3bc262c9a94da58dbf1e56 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
%%
%% This is file `infwarerr-test2.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% infwarerr.dtx  (with options: `test2')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%% 
%% This work consists of the main source file infwarerr.dtx
%% and the derived files
%%    infwarerr.sty, infwarerr.pdf, infwarerr.ins, infwarerr.drv,
%%    infwarerr-test1.tex, infwarerr-test2.tex,
%%    infwarerr-test3.tex.
%% 
\let\PackageInfo\relax
\input infwarerr.sty\relax
\let\OrgWrite\write
\chardef\WriteUnused=16 %
\def\msg#{\immediate\OrgWrite\WriteUnused}
\msg{File: infwarerr-test2.tex 2007/09/09 v1.2 Test file for plain-TeX}
\catcode64=11 %
\def\pkgname{PACKAGE}
\def\clsname{CLASS}
\def\msgtext{MESSAGE\MessageBreak SECOND LINE}
\def\hlptext{HELP\MessageBreak SECOND LINE}

\let\OrgWrite\write
\let\OrgErrMessage\errmessage

\def\write#1#{%
  \@write{#1}%
}
\def\@write#1#2{%
  \OrgWrite#1{#2}%
  \xdef\WriteNum{\number#1}%
  \xdef\WriteText{#2}%
}
\def\TestFailed#1#2{%
  \OrgErrMessage{Test (\string#1) failed: #2}%
}
\def\TestWrite#1#2#3{%
  \ifnum\WriteNum=#2\relax
  \else
    \TestFailed#1{write stream number: \WriteNum <> #2}%
  \fi
  \begingroup
    \let~\space
    \edef\TestString{#3}%
    \ifx\WriteText\TestString
    \else
      \msg{}%
      \msg{[\WriteText]}%
      \msg{<>}%
      \msg{[#3]}% hash-ok
      \TestFailed#1{write text}%
    \fi
  \endgroup
}
\newtoks\ErrHelpToks
\def\errmessage#1{%
  \global\ErrHelpToks=\expandafter{\the\errhelp}%
  \msg{**************** error message ****************}%
  \msg{! #1}%
  \msg{**************** help message *****************}%
  \msg{\the\errhelp}%
  \msg{***********************************************}%
  \xdef\ErrMessage{! #1}%
}
\def\TestInfo{%
  \@PackageInfo\pkgname\msgtext
  \TestWrite\@PackageInfo{-1}{%
    Package PACKAGE Info: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~SECOND LINE on input line \the\inputlineno.%
  }%
  \@PackageInfoNoLine\pkgname\msgtext
  \TestWrite\@PackageInfoNoLine{-1}{%
    Package PACKAGE Info: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~SECOND LINE.%
  }%
  \@ClassInfo\clsname\msgtext
  \TestWrite\@ClassInfo{-1}{%
    Class CLASS Info: MESSAGE^^J%
    (CLASS)~~~~~~~~~~~SECOND LINE on input line \the\inputlineno.%
  }%
  \@ClassInfoNoLine\clsname\msgtext
  \TestWrite\@ClassInfoNoLine{-1}{%
    Class CLASS Info: MESSAGE^^J%
    (CLASS)~~~~~~~~~~~SECOND LINE.%
  }%
}
\def\TestWarning{%
  \@PackageWarning\pkgname\msgtext
  \TestWrite\@PackageWarning\WriteUnused{%
    ^^J%
    Package PACKAGE Warning: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~~~~SECOND LINE on input line \the\inputlineno.%
    ^^J%
  }%
  \@PackageWarningNoLine\pkgname\msgtext
  \TestWrite\@PackageWarningNoLine\WriteUnused{%
    ^^J%
    Package PACKAGE Warning: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~~~~SECOND LINE.%
    ^^J%
  }%
  \@ClassWarning\clsname\msgtext
  \TestWrite\@ClassWarning\WriteUnused{%
    ^^J%
    Class CLASS Warning: MESSAGE^^J%
    (CLASS)~~~~~~~~~~~~~~SECOND LINE on input line \the\inputlineno.%
    ^^J%
  }%
  \@ClassWarningNoLine\clsname\msgtext
  \TestWrite\@ClassWarningNoLine\WriteUnused{%
    ^^J%
    Class CLASS Warning: MESSAGE^^J%
    (CLASS)~~~~~~~~~~~~~~SECOND LINE.%
    ^^J%
  }%
}
\def\TestError{%
  \def\plaindots{.^^J ...^^J}
  \@PackageError\pkgname\msgtext\hlptext
  \@TestError\@PackageError{%
    ! Package PACKAGE Error: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~~~~SECOND LINE.^^J%
    ^^J%
    See the PACKAGE package documentation for explanation.^^J%
    Type~~H <return>~~for immediate help\plaindots
  }{%
    HELP^^J%
    SECOND LINE%
  }%
  \@ClassError\clsname\msgtext\hlptext
  \@TestError\@ClassError{%
    ! Class CLASS Error: MESSAGE^^J%
    (CLASS)~~~~~~~~~~~~~~SECOND LINE.^^J%
    ^^J%
    See the CLASS class documentation for explanation.^^J%
    Type~~H <return>~~for immediate help\plaindots
  }{%
    HELP^^J%
    SECOND LINE%
  }%
  \@PackageError\pkgname\msgtext\@ehc
  \@TestError\@PackageError{%
    ! Package PACKAGE Error: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~~~~SECOND LINE.^^J%
    ^^J%
    See the PACKAGE package documentation for explanation.^^J%
    Type~~H <return>~~for immediate help\plaindots
  }{%
    Try typing~~<return>~~to proceed.^^J%
    If that doesn't work, type~~X <return>~~to quit.%
  }%
  \@PackageError\pkgname\msgtext\@ehd
  \@TestError\@PackageError{%
    ! Package PACKAGE Error: MESSAGE^^J%
    (PACKAGE)~~~~~~~~~~~~~~~~SECOND LINE.^^J%
    ^^J%
    See the PACKAGE package documentation for explanation.^^J%
    Type~~H <return>~~for immediate help\plaindots
  }{%
    You're in trouble here.~~Try typing~~<return>~~to proceed.^^J%
    If that doesn't work, type~~X <return>~~to quit.%
  }%
}
\def\@TestError#1#2#3{%
  \begingroup
    \let~\space
    \edef\x{#2}%
    \ifx\x\ErrMessage
    \else
      \msg{}%
      \msg{[\ErrMessage]}%
      \msg{<>}%
      \msg{[\x]}%
      \TestFailed#1{errmessage text}%
    \fi
    \edef\x{\the\ErrHelpToks}%
    \edef\y{#3}%
    \ifx\x\y
    \else
      \msg{}%
      \msg{[\the\ErrHelpToks]}%
      \msg{<>}%
      \msg{[\y]}%
      \TestFailed#1{errhelp text}%
    \fi
  \endgroup
}
\TestInfo
\TestWarning
\TestError
\end
\endinput
%%
%% End of file `infwarerr-test2.tex'.