%%
%% This is file `catchfile-test3.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% catchfile.dtx  (with options: `test3')
%% 
%% This is a generated file.
%% 
%% Project: catchfile
%% Version: 2011/03/01 v1.6
%% 
%% Copyright (C) 2007, 2010, 2011 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 catchfile.dtx
%% and the derived files
%%    catchfile.sty, catchfile.pdf, catchfile.ins, catchfile.drv,
%%    catchfile-test1.tex, catchfile-test2.tex,
%%    catchfile-test3.tex.
%% 
\def\msg#{\immediate\write16}
\newlinechar=10 %
\tracingnesting=2 %
\input catchfile.sty\relax

\def\mysetup{%
  \def\do##1{%
    \catcode`##1=12\relax
  }%
  \dospecials
}
\def\CheckContents{%
  \begingroup
    \expandafter\ifx\csname contents\endcsname\relax
      \def\space{ }%
      \errmessage{\string\contents\space is not defined.}%
    \fi
  \endgroup
}
\catcode`\@=11 %
\def\CheckCleanup{%
  \begingroup
    \edef\x{\the\toks0}%
    \def\y{ABC}%
    \ifx\x\y
    \else
      \errmessage{\string\toks0 has changed}%
    \fi
    \ifx\CatchFile@gtemp\@undefined
    \else
      \errmessage{Left over \string\CatchFile@gtemp}%
    \fi
  \endgroup
}
\def\Check{%
  \CheckContents
  \CheckCleanup
}
\def\StartDisableUnexpanded{%
  \begingroup
    \let\etex@unexpanded\@undefined
}
\def\StopDisableUnexpanded{%
  \endgroup
}
\catcode`\@=12 %

\toks0{ABC}

\CatchFileDef\contents{catchfile.sty}\mysetup
\msg{\meaning\contents}
\Check
\msg{***********************************************************}%
\CatchFileDef\contents{catchfile.sty}{}
\msg{\meaning\contents}
\Check
\msg{***********************************************************}%

\StartDisableUnexpanded
\CatchFileDef\contents{catchfile.sty}\mysetup
\msg{\meaning\contents}
\Check
\msg{***********************************************************}%
\CatchFileDef\contents{catchfile.sty}{}
\msg{\meaning\contents}
\Check
\msg{***********************************************************}%
\StopDisableUnexpanded

\CatchFileEdef\contents{catchfile.sty}{%
  \mysetup
  \def\par{^^J}%
  \obeylines
}
\msg{\contents}
\Check
\msg{***********************************************************}%
\CatchFileEdef\contents{catchfile.sty}{%
  \catcode`\\=12 %
  \catcode`\#=12 %
  \def\par{^^J}%
  \obeylines
}
\msg{\contents}
\Check
\msg{***********************************************************}%

\csname @@end\endcsname
\end
\endinput
%%
%% End of file `catchfile-test3.tex'.
