diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/oberdiek/test/letltxmacro-test2.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/oberdiek/test/letltxmacro-test2.tex | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/oberdiek/test/letltxmacro-test2.tex b/Master/texmf-dist/doc/latex/oberdiek/test/letltxmacro-test2.tex new file mode 100644 index 00000000000..435b40b9a70 --- /dev/null +++ b/Master/texmf-dist/doc/latex/oberdiek/test/letltxmacro-test2.tex @@ -0,0 +1,130 @@ +%% +%% 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 <oberdiek@uni-freiburg.de> +%% +%% 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-test1.tex, letltxmacro-test2.tex. +%% +\NeedsTeXFormat{LaTeX2e} +\nofiles +\documentclass{minimal} + +\usepackage{letltxmacro}[2008/06/09] + +\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:->}% +\end{qstest} +\csname @@end\endcsname +\endinput +%% +%% End of file `letltxmacro-test2.tex'. |