summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex')
-rw-r--r--Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex180
1 files changed, 179 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex b/Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex
index 83e1af9cae0..09de50d18dc 100644
--- a/Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex
+++ b/Master/texmf-dist/doc/latex/oberdiek/pdfescape-test3.tex
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\makeatletter
\ProvidesFile{pdfescape-test3.tex}%
- [2007/04/11 v1.3 Test without \string\pdfescape... and e-TeX]%
+ [2007/04/21 v1.4 Test without \string\pdfescape... and e-TeX]%
\let\pdfescapehex\@undefined
\let\pdfunescapehex\@undefined
\let\pdfescapename\@undefined
@@ -41,6 +41,14 @@
\LogTests{lgout}{*}{*}
\newcommand*{\ExpectVar}[2]{%
+ \ifx#1#2%
+ \else
+ \begingroup
+ \@onelevel@sanitize#1%
+ \@onelevel@sanitize#2%
+ \typeout{[#1] <> [#2]}%
+ \endgroup
+ \fi
\Expect*{\ifx#1#2true\else false\fi}{true}%
}
@@ -183,6 +191,28 @@
\ExpectVar\x\z
\end{qstest}
+\begin{qstest}{unhex-hash}{unescapehex, hash}
+ \catcode`\#=12 %
+ \EdefUnescapeHex\x{#20}%
+ \ExpectVar\x\space
+\end{qstest}
+
+\begin{qstest}{unhex-invalid}{unescapehex, invalid}
+ \def\test#1#2{%
+ \EdefUnescapeHex\x{#1}%
+ \edef\y{#2}%
+ \@onelevel@sanitize\y
+ \ExpectVar\x\y
+ }%
+ \test{X}{}%
+ \test{XY}{}%
+ \test{XYZ}{}%
+ \test{A}{^^a0}%
+ \test{AX}{^^a0}%
+ \test{XA}{^^a0}%
+ \test{XXAXX}{^^a0}%
+\end{qstest}
+
\begin{qstest}{all-name}{\AllBytes, escapename}
\EdefEscapeName\x{\AllBytes}%
\Expect*{\x}*{\AllBytesName}%
@@ -195,6 +225,154 @@
\ExpectVar\x\AllBytesString
\end{qstest}
+\begin{qstest}{uchexdigit}{unescape, uppercase hex digit}
+ \catcode`\@=11 %
+ \catcode0=12 %
+ \def\test#1#2{%
+ \uccode0=#1\relax
+ \uppercase{%
+ \def\x{^^@}%
+ }%
+ \Expect*{%
+ \ifcase\expandafter\PE@TestUcHexDigit\x
+ true%
+ \else
+ false%
+ \fi
+ }{#2}%
+ }%
+ \def\range#1#2#3{%
+ \count0=#1\relax
+ \loop
+ \ifnum\count0<#2\relax
+ \test{\count0}{#3}%
+ \advance\count0 by 1 %
+ \repeat
+ }%
+ \range{0}{47}{false}%
+ \range{48}{57}{true}%
+ \range{58}{64}{false}%
+ \range{65}{70}{true}%
+ \range{71}{255}{false}%
+\end{qstest}
+
+\begin{qstest}{unescapename}{unescapename}
+ \def\test#1#2{%
+ \EdefUnescapeName\x{#1}%
+ \edef\y{#2}%
+ \@onelevel@sanitize\y
+ \ExpectVar\x\y
+ }%
+ \catcode`\#=12 %
+ \catcode0=12 %
+ \test{}{}%
+ \test{x}{x}%
+ \test{xy}{xy}%
+ \test{#}{#}%
+ \test{##}{##}%
+ \test{###}{###}%
+ \test{####}{####}%
+ \test{#x}{#x}%
+ \test{#xy}{#xy}%
+ \test{#1}{#1}%
+ \test{#40}{@}%
+ \test{#400}{@0}%
+ \test{#4x0}{#4x0}%
+ \test{#ab}{^^ab}%
+ \test{#00}{^^@}%
+ \test{x#40y#40z}{x@y@z}%
+ \test{#40#40#40#40}{@@@@}%
+ \test{a#x}{a#x}%
+ \test{a#xy}{a#xy}%
+ \test{a#1}{a#1}%
+ \test{a#40}{a@}%
+ \test{a#400}{a@0}%
+ \test{#20}{ }%
+ \test{a#20}{a }%
+ \test{a#20b}{a b}%
+ \test{a#20#20#20b}{a \space\space b}%
+\end{qstest}
+
+\begin{qstest}{unescapestring}{unescapestring}
+ \def\test#1#2{%
+ \EdefUnescapeString\x{#1}%
+ \edef\y{#2}%
+ \@onelevel@sanitize\y
+ \ExpectVar\x\y
+ }%
+ \catcode0=12 %
+ \def\DefChar#1#2{%
+ \begingroup
+ \uccode0=#2\relax
+ \uppercase{\endgroup
+ \def#1{^^@}%
+ }%
+ }%
+ \DefChar\nul{0}%
+ \DefChar\one{1}%
+ \DefChar\bel{8}%
+ \DefChar\tab{9}%
+ \DefChar\lf{10}%
+ \DefChar\ff{12}%
+ \DefChar\cr{13}%
+ \DefChar\\{92}%
+ \test{}{}%
+ \test{a}{a}%
+ \test{\\}{}%
+ \test{\\\\}{\\}%
+ \test{\\\\y}{\\y}%
+ \test{\\000}{\nul}%
+ \test{\\b}{\bel}%
+ \test{\\t}{\tab}%
+ \test{\\n}{\lf}%
+ \test{\\f}{\ff}%
+ \test{\\r}{\cr}%
+ \test{\\(}{(}%
+ \test{\\)}{)}%
+ \test{\\040}{ }%
+ \test{\\100}{@}%
+ \test{\\40}{ }%
+ \test{\\1}{\one}%
+ \test{\\01}{\one}%
+ \test{\\001}{\one}%
+ \test{\\18}{\one8}%
+ \test{\\018}{\one8}%
+ \test{\\0018}{\one8}%
+ \test{x\\}{x}%
+ \test{x\\\\}{x\\}%
+ \test{x\\\\y}{x\\y}%
+ \test{x\\000}{x\nul}%
+ \test{x\\b}{x\bel}%
+ \test{x\\t}{x\tab}%
+ \test{x\\n}{x\lf}%
+ \test{x\\f}{x\ff}%
+ \test{x\\r}{x\cr}%
+ \test{x\\(}{x(}%
+ \test{x\\)}{x)}%
+ \test{x\\040}{x }%
+ \test{x\\100}{x@}%
+ \test{x\\40}{x }%
+ \test{x\\1}{x\one}%
+ \test{x\\01}{x\one}%
+ \test{x\\001}{x\one}%
+ \test{x\\18}{x\one8}%
+ \test{x\\018}{x\one8}%
+ \test{x\\0018}{x\one8}%
+ \test{\\b\\t\\n\\f\\r\\(\\)\\\\\\000\\040}{%
+ \bel\tab\lf\ff\cr()\\\nul\space
+ }%
+ \test{\\\lf}{}%
+ \test{x\\\lf}{x}%
+ \test{\cr}{\lf}%
+ \test{\cr\lf}{\lf}%
+ \test{\lf}{\lf}%
+ \test{\lf\cr}{\lf\lf}%
+ \test{x\cr}{x\lf}%
+ \test{x\cr\lf}{x\lf}%
+ \test{x\lf}{x\lf}%
+ \test{x\lf\cr}{x\lf\lf}%
+ \test{x\\\cr\lf y\cr}{xy\lf}%
+\end{qstest}
\stop
\endinput
%%