%%
%% This is file `infwarerr-test3.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% infwarerr.dtx  (with options: `test3')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%% 
%% 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.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{infwarerr-test3.tex}[2007/09/09 v1.2 Test file for LaTeX]
\RequirePackage{infwarerr}[2007/09/09]
\makeatletter
\let\OrgWrite\write
\chardef\WriteUnused=\@unused
\def\msg#{\immediate\OrgWrite\WriteUnused}
\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{%
  \let\write\OrgWrite
  \def\plaindots{}
  \@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}%
  \@onelevel@sanitize\x
  \@onelevel@sanitize\ErrMessage
    \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-test3.tex'.
