summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/oberdiek/test/refcount-test2.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/oberdiek/test/refcount-test2.tex')
-rw-r--r--Master/texmf-dist/doc/latex/oberdiek/test/refcount-test2.tex199
1 files changed, 199 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/oberdiek/test/refcount-test2.tex b/Master/texmf-dist/doc/latex/oberdiek/test/refcount-test2.tex
new file mode 100644
index 00000000000..e463973a7a4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/oberdiek/test/refcount-test2.tex
@@ -0,0 +1,199 @@
+%%
+%% This is file `refcount-test2.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% refcount.dtx (with options: `test2')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 1998, 2000, 2006, 2008, 2010 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.
+%%
+%% This work consists of the main source file refcount.dtx
+%% and the derived files
+%% refcount.sty, refcount.pdf, refcount.ins, refcount.drv,
+%% refcount-test1.tex, refcount-test2.tex, refcount-test3.tex,
+%% refcount-test4.tex.
+%%
+\errorcontextlines=10000 %
+\showboxbreadth=10000 %
+\showboxdepth=10000 %
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input refcount.sty\relax
+\else
+ \RequirePackage{refcount}[2010/12/01]%
+\fi
+\catcode`\@=11 %
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname @onelevel@sanitize\endcsname\relax
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname detokenize\endcsname\relax
+ \def\strip@prefix#1->{}%
+ \def\@onelevel@sanitize#1{%
+ \edef#1{%
+ \expandafter\strip@prefix\meaning#1%
+ }%
+ }%
+ \else
+ \def\@onelevel@sanitize#1{%
+ \edef#1{%
+ \detokenize\expandafter{#1}%
+ }%
+ }%
+ \fi
+\fi
+\def\msg#{\immediate\write16}
+\def\empty{}
+\def\space{ }
+\def\r@foo{{\empty 1}{\empty 2}}
+\long\def\test#1#2{%
+ \begingroup
+ \setbox0=\hbox{%
+ \def\TestTask{#1}%
+ \@onelevel@sanitize\TestTask
+ \msg{* \TestTask}%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\TestResult
+ \expandafter\expandafter\expandafter{%
+ #1%
+ }%
+ \def\TestExpected{#2}%
+ \ifx\TestResult\TestExpected
+ \msg{ \space ok.}%
+ \else
+ \@onelevel@sanitize\TestResult
+ \@onelevel@sanitize\TestExpected
+ \msg{ \space Result: \space\space[\TestResult]}%
+ \msg{ \space Expected: [\TestExpected]}%
+ \errmessage{Test failed!}%
+ \fi
+ }%
+ \ifdim\wd0=0pt %
+ \else
+ \showbox0 %
+ \fi
+ \endgroup
+}
+\test{\getrefnumber{foo}}{\empty 1}
+\test{\getpagerefnumber{foo}}{\empty 2}
+\test{\getrefbykeydefault{foo}{}{\empty default}}{\empty 1}
+\test{\getrefbykeydefault{foo}{page}{\empty default}}{\empty 2}
+\test{\getrefbykeydefault{foo}{name}{\empty default}}{\empty default}
+\test{\getrefbykeydefault{foo}{anchor}{\empty default}}{\empty default}
+\test{\getrefbykeydefault{foo}{url}{\empty default}}{\empty default}
+\test{\getrefbykeydefault{foo}{title}{\empty default}}{\empty default}
+\msg{}
+\def\r@foo{{}{}{}{}{}{}{}{}{}{}}
+\def\Test#1#2\\{%
+ \test{#1{foo}#2}{}%
+}
+\def\TestGroup{%
+ \Test\getrefnumber\\%
+ \Test\getpagerefnumber\\%
+ \Test\getrefbykeydefault{}{}\\%
+ \Test\getrefbykeydefault{page}{}\\%
+ \Test\getrefbykeydefault{anchor}{}\\%
+ \Test\getrefbykeydefault{name}{}\\%
+ \Test\getrefbykeydefault{url}{}\\%
+}
+\TestGroup
+\Test\getrefbykeydefault{title}{}\\%
+\msg{}
+\def\r@foo{\par\par\par\par\par\par\par\par}
+\long\def\Test#1#2\\{%
+ \test{#1{foo}#2}{\par}%
+}
+\TestGroup
+\test{\getrefbykeydefault{title}{}{}}{}
+\msg{}
+\def\r@foo{{ }{ }{ }{ }{ }}
+\def\Test#1#2\\{%
+ \test{#1{foo}#2}{ }%
+}
+\TestGroup
+\msg{}
+\long\def\TestDefault#1{%
+ \begingroup
+ \setrefcountdefault{#1}%
+ \test{\getrefnumber{foo}}{#1}%
+ \test{\getpagerefnumber{foo}}{#1}%
+ \endgroup
+}
+\def\TestDefaultX{%
+ \TestDefault{}%
+ \TestDefault{\par}%
+ \TestDefault{ }%
+ \TestDefault{\space}%
+}
+\let\r@foo\@undefined
+\TestDefaultX
+\let\r@foo\relax
+\TestDefaultX
+\def\r@foo{}
+\TestDefaultX
+\msg{}
+\long\def\Test#1#2#3#4{%
+ \begingroup
+ \def\TestTask{#1}%
+ \@onelevel@sanitize\TestTask
+ \msg{* [\TestTask]}%
+ \edef\TestResultA{\IfRefUndefinedExpandable{#1}{#2}{#3}}%
+ \IfRefUndefinedBabel{#1}{%
+ \def\TestResultB{#2}%
+ }{%
+ \def\TestResultB{#3}%
+ }%
+ \def\TestExpected{#4}%
+ \ifx\TestResultA\TestExpected
+ \msg{ \space ok.}%
+ \else
+ \begingroup
+ \@onelevel@sanitize\TestResultA
+ \@onelevel@sanitize\TestExpected
+ \msg{ \space Result: \space\space[\TestResultA]}%
+ \msg{ \space Expected: [\TestExpected]}%
+ \errmessage{Test failed!}%
+ \endgroup
+ \fi
+ \ifx\TestResultB\TestExpected
+ \msg{ \space ok.}%
+ \else
+ \begingroup
+ \@onelevel@sanitize\TestResultB
+ \@onelevel@sanitize\TestExpected
+ \msg{ \space Result: \space\space[\TestResultB]}%
+ \msg{ \space Expected: [\TestExpected]}%
+ \errmessage{Test failed!}%
+ \endgroup
+ \fi
+ \endgroup
+}
+\begingroup
+ \def\r@foo{{}{}}%
+ \let\r@bar\@undefined
+ \let\r@xyz\relax
+ \Test{foo}{true}{false}{false}%
+ \Test{bar}{true}{false}{true}%
+ \Test{xyz}{true}{false}{true}%
+\endgroup
+\csname @@end\endcsname\end
+\endinput
+%%
+%% End of file `refcount-test2.tex'.