diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/oberdiek/iflang-test3.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/oberdiek/iflang-test3.tex | 138 |
1 files changed, 77 insertions, 61 deletions
diff --git a/Master/texmf-dist/doc/latex/oberdiek/iflang-test3.tex b/Master/texmf-dist/doc/latex/oberdiek/iflang-test3.tex index 9c62d2115a1..667bd85afac 100644 --- a/Master/texmf-dist/doc/latex/oberdiek/iflang-test3.tex +++ b/Master/texmf-dist/doc/latex/oberdiek/iflang-test3.tex @@ -25,68 +25,84 @@ %% This work consists of the main source file iflang.dtx %% and the derived files %% iflang.sty, iflang.pdf, iflang.ins, iflang.drv, -%% iflang-test1.tex, iflang-test2.tex, iflang-test3.tex. +%% iflang-test1.tex, iflang-test2.tex, iflang-test3.tex, +%% iflang-test4.tex, iflang-test5.tex. %% -%% Format `tex' (vanilla plain-TeX) -\let\ifcsname\UNDEFINED -\let\pdfstrcmp\UNDEFINED -\input iflang.sty -\catcode64=11 - -\def\TestDefined#1{% - \IfLang@IfDefined{foobar}{}{}% - \ifx\foobar#1% - \else - \errmessage{Failed test: \string\foobar <> \string#1}% - \fi -} -\let\foobar\relax -\TestDefined\relax -\let\foobar\UNDEFINED -\TestDefined\relax - -\def\strip@prefix#1>{} -\def\@onelevel@sanitize#1{% - \edef#1{\expandafter\strip@prefix\meaning#1}% -} -\def\TestCompare#1#2#3{% - \begingroup - \edef\x{% - \if\IfLang@StrEqual{#1}{#2}% - true% - \else - false% - \fi - }% - \def\expect{#3}% - \ifx\x\expect - \else - \def\a{#1}% - \@onelevel@sanitize\a - \def\b{#2}% - \@onelevel@sanitize\b - \errmessage{Failed test: `\a'='\b' <> \expect}% - \fi - \endgroup -} -\TestCompare{junk}{junk}{true} -\TestCompare{}{}{true} -\TestCompare{a}{b}{false} -\TestCompare{aa}{bb}{false} -\def\a{ax} -\def\b{bx} -\def\c{\a\b} -\def\d{\c\b} -\def\exch#1#2{#2#1} -\def\gobble#1{} -\TestCompare{\gobble a}{}{true} -\TestCompare{}{\gobble a}{true} -\TestCompare{a\exch xyb}{ayxb}{true} -\TestCompare{\c}{\c}{true} -\TestCompare{\d}{\c\b}{true} - -\csname @@end\endcsname -\end +\NeedsTeXFormat{LaTeX2e} +\let\pdfstrcmp\relax +\nofiles +\documentclass{minimal} +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +\usepackage[english,naustrian,ngerman]{babel} +\usepackage{iflang} +\begin{document} +\begin{qstest}{IfLanguagePatterns}{language, pattern} + \def\test#1#2{% + \Expect*{\IfLanguagePatterns{#1}{true}{false}}{#2}% + }% + \test{ngerman}{true}% + \test{naustrian}{true}% + \test{english}{false}% + \test{foobar}{false}% +\end{qstest} +\begin{qstest}{IfLanguageName}{language, name} + \def\test#1#2{% + \Expect*{\IfLanguageName{#1}{true}{false}}{#2}% + }% + \test{ngerman}{true}% + \test{naustrian}{false}% + \selectlanguage{naustrian}% + \test{ngerman}{false}% + \test{naustrian}{true}% + \test{foobar}{false}% + % + \def\languagename{naustrian}% + \test{naustrian}{true}% + \test{ngerman}{false}% + % + \edef\languagename{\string naustrian}% + \test{naustrian}{true}% + \test{ngerman}{false}% + % + \def\languagename{naustrian}% + \makeatletter + \@onelevel@sanitize\languagename + \test{naustrian}{true}% + \test{ngerman}{false}% + % + \def\languagename{naustrian}% + \def\xaustrian{naustrian}% + \def\xgerman{ngerman}% + \test{\xaustrian}{true}% + \test{\xgerman}{false}% + % + \def\languagename{\xaustrian}% + \test{naustrian}{true}% + \test{ngerman}{false}% + \test{\xaustrian}{true}% + \test{\xgerman}{false}% + \test{\languagename}{true}% + \test{\languagename\space}{false}% + % + \def\languagename{\empty\xaustrian\empty}% + \test{naustrian}{true}% + \test{ngerman}{false}% + \test{\empty\xaustrian\empty}{true}% + \test{\empty\xgerman\empty}{false}% +\end{qstest} +\begin{qstest}{IfDefined}{defined} + \makeatletter + \let\foobar\relax + \Expect*{\IfLang@IfDefined{foobar}{true}{false}}{false}% + \Expect*{\ifx\foobar\relax true\else false\fi}{true}% + \let\foobar\UNDEFINED + \Expect*{\IfLang@IfDefined{foobar}{true}{false}}{false}% + \Expect*{\ifx\foobar\relax true\else false\fi}{false}% + \Expect*{\ifx\foobar\UNDEFINED true\else false\fi}{true}% +\end{qstest} +\end{document} \endinput %% %% End of file `iflang-test3.tex'. |