%% %% This is file `letltxmacro-test2.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% letltxmacro.dtx (with options: `test2') %% %% This is a generated file. %% %% Copyright (C) 2008 by Heiko Oberdiek %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3 of this license or (at your option) any later %% version. 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. %% %% This work consists of the main source file letltxmacro.dtx %% and the derived files %% letltxmacro.sty, letltxmacro.pdf, letltxmacro.ins, letltxmacro.drv, %% letltxmacro-showcases.tex, letltxmacro-test1.tex, %% letltxmacro-test2.tex. %% \NeedsTeXFormat{LaTeX2e} \nofiles \documentclass{minimal} \usepackage{letltxmacro}[2008/06/24] \usepackage{qstest} \IncludeTests{*} \LogTests{log}{*}{*} \makeatletter \def\TestDef#1{% \begingroup \@makeother\\% \@makeother\ % \expandafter\@TestDef\csname #1\endcsname } \def\@TestDef#1#2{% \edef\a{\expandafter\strip@prefix\meaning#1}% \edef\b{\detokenize{#2}}% \ifx\a\b \else \typeout{1 [\a]}% \typeout{2 [\b]}% \fi \endgroup \Expect*{\expandafter\strip@prefix\meaning#1}*{\detokenize{#2}}% } \def\TestEquals#1#2{% \Expect*{% \expandafter\ifx\csname#1\expandafter\endcsname \csname#2\endcsname equals% \else wrong% \fi }{equals}% } \def\SaveA{% \let\SavedA\TestA \expandafter\let\csname\string\SavedA\expandafter\endcsname \csname\string\TestA\endcsname \expandafter\let\csname SavedA \expandafter\endcsname \csname TestA \endcsname } \def\CheckA{% \TestEquals{SavedA}{TestA}% \TestEquals{\string\SavedA}{\string\TestA}% \TestEquals{SavedA }{TestA }% } \begin{qstest}{robust}{robust} \DeclareRobustCommand*{\TestA}{Test}% \SaveA \TestDef{TestA}{\protect \TestA }% \CheckA \DeclareRobustCommand{\TestA}{Test}% \SaveA \TestDef{TestA}{\protect \TestA }% \LetLtxMacro\TestB\TestA \TestDef{TestB}{\protect \TestB }% \TestEquals{TestB }{TestA }% \CheckA \end{qstest} \begin{qstest}{default}{default} \newcommand{\TestA}[1][\relax default \empty]{TestA #1}% \SaveA \TestDef {TestA}{\@protected@testopt \TestA \\TestA {\relax default \empty }}% \LetLtxMacro\TestB\TestA \TestDef {TestB}{\@protected@testopt \TestB \\TestB {\relax default \empty }}% \CheckA \end{qstest} \begin{qstest}{robustdefault}{robustdefault} \DeclareRobustCommand{\TestA}[1][\default]{TestA}% \SaveA \LetLtxMacro\TestB\TestA \TestDef{TestB}{\protect \TestB }% \TestDef{TestB }{\@protected@testopt \TestB \\TestB {\default }}% \CheckA \end{qstest} \begin{qstest}{plain}{plain} \LetLtxMacro\NewRelax\relax \Expect*{\meaning\relax}*{\string\relax}% \Expect*{\meaning\NewRelax}*{\string\relax}% \LetLtxMacro\NewHbox\hbox \Expect*{\meaning\hbox}*{\string\hbox}% \Expect*{\meaning\NewHbox}*{\string\hbox}% \LetLtxMacro\NewEmpty\empty \Expect*{\meaning\empty}{macro:->}% \Expect*{\meaning\NewEmpty}{macro:->}% \def\TestA{\iffalse}% \LetLtxMacro\TestB\TestA \TestDef{TestB}{\iffalse }% \TestEquals{TestA}{TestB}% \end{qstest} \usepackage{etoolbox}[2008/06/22] \begin{qstest}{oldnewrobustcmd}{oldnewrobustcmd} \protected\edef\TestA{% \noexpand\@protected@testopt \noexpand\TestA \expandafter\noexpand\csname\string\TestA\endcsname {\noexpand\default}% }% \expandafter\protected\expandafter \def\csname\string\TestA\endcsname{TestA}% \SaveA \LetLtxMacro\TestB\TestA \TestDef{TestB}{\@protected@testopt \TestB \\TestB {\default }}% \protected\edef\TestC{% \noexpand\@protected@testopt \noexpand\TestB \expandafter\noexpand\csname\string\TestB\endcsname {\noexpand\default}% }% \TestEquals{TestB}{TestC}% \CheckA \end{qstest} \begin{qstest}{newrobustcmd}{newrobustcmd} \newrobustcmd{\TestA}[1][\default]{TestA}% \SaveA \LetLtxMacro\TestB\TestA \TestDef{TestB}{\@testopt \\TestB {\default }}% \protected\edef\TestC{% \noexpand\@testopt \expandafter\noexpand\csname\string\TestB\endcsname {\noexpand\default}% }% \TestEquals{TestB}{TestC}% \CheckA \end{qstest} \begin{qstest}{robustifyopt}{robustifyopt} \newcommand{\TestA}[2][\default]{}% \TestDef{TestA}{\@protected@testopt \TestA \\TestA {\default }}% \robustify\TestA \TestDef{TestA}{\@protected@testopt \TestA \\TestA {\default }}% \protected\edef\TestC{% \noexpand\@protected@testopt \noexpand\TestA \expandafter\noexpand\csname\string\TestA\endcsname {\noexpand\default}% }% \TestEquals{TestA}{TestC}% \SaveA \LetLtxMacro\TestB\TestA \TestDef{TestB}{\@protected@testopt \TestB \\TestB {\default }}% \protected\edef\TestC{% \noexpand\@protected@testopt \noexpand\TestB \expandafter\noexpand\csname\string\TestB\endcsname {\noexpand\default}% }% \TestEquals{TestB}{TestC}% \CheckA \end{qstest} \begin{qstest}{robustifydeclare}{robustifydeclare} \DeclareRobustCommand\TestA{\iffalse}% \robustify\TestA \SaveA \LetLtxMacro\TestB\TestA \TestDef{TestB}{\iffalse }% % before etoolbox 2008/06/22: \protected\long\def % since etoolbox 2008/06/22: \protected\def \protected\def\TestC{\iffalse}% \TestEquals{TestB}{TestC}% \CheckA \end{qstest} \begin{qstest}{robustifydeclarelong}{robustifydeclarelong} \DeclareRobustCommand\TestA[1]{\iffalse}% \robustify\TestA \SaveA \LetLtxMacro\TestB\TestA \TestDef{TestB}{\iffalse }% % before etoolbox 2008/06/22: \protected\long\def % since etoolbox 2008/06/22: \protected\def \protected\long\def\TestC#1{\iffalse}% \TestEquals{TestB}{TestC}% \CheckA \end{qstest} \csname @@end\endcsname \endinput %% %% End of file `letltxmacro-test2.tex'.