diff options
| author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2011-05-21 16:31:03 +0200 | 
|---|---|---|
| committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2011-05-21 16:31:03 +0200 | 
| commit | cbc564d6c73b4d6139419b7e1722deb633833a77 (patch) | |
| tree | bf9e0c46735f6962a28b9db0f4e6c0508b368a7c | |
| parent | ddf0ebc277361f955b47575e08dfc8fc63fe493a (diff) | |
| download | luatexbase-cbc564d6c73b4d6139419b7e1722deb633833a77.tar.gz | |
Import tests from Heiko.
| -rw-r--r-- | Makefile | 9 | ||||
| -rw-r--r-- | TODO | 4 | ||||
| -rw-r--r-- | luatex.dtx | 341 | 
3 files changed, 341 insertions, 13 deletions
@@ -142,9 +142,12 @@ check-base: $(UNPACKED_BASE)  	luatex --interaction=batchmode test-base-plain.tex >/dev/null  	lualatex --interaction=batchmode test-base-latex.tex >/dev/null -check-luatex: $(UNPACKED_LUATEX) -	luatex --interaction=batchmode test-luatex-plain.tex >/dev/null -	lualatex --interaction=batchmode test-luatex-latex.tex >/dev/null +check-luatex: install-runfiles +	#$(TESTENV) lualatex --interaction=batchmode test-luatex1.tex >/dev/null +	#$(TESTENV) lualatex --interaction=batchmode test-luatex2.tex >/dev/null +	#$(TESTENV) lualatex --interaction=batchmode test-luatex3.tex >/dev/null +	#$(TESTENV) lualatex --interaction=batchmode test-luatex4.tex >/dev/null +	#$(TESTENV) luatex --interaction=batchmode test-luatex5.tex >/dev/null  $(CTAN_ZIP): $(SOURCE) $(COMPILED) $(TDS_ZIP)  	@echo "Making $@ for CTAN upload." @@ -1,8 +1,8 @@  Next actions  ------------ -2. Merge with luatex.sty (inc test suite). -3. Coordinate release with Heiko. +- pass the test suite of luatex.sty +- Coordinate release with Heiko.  test suite  ---------- @@ -41,8 +41,11 @@ See source file '\inFileName' for licence and contact information.  \generate{%    \usedir{doc/luatex/luatexbase}% -  \file{test-luatex-plain.tex}{\from{luatex.dtx}{testplain}}% -  \file{test-luatex-latex.tex}{\from{luatex.dtx}{testlatex}}% +  \file{test-luatex1.tex}{\from{luatex.dtx}{test1}}% +  \file{test-luatex2.tex}{\from{luatex.dtx}{test1,test2}}% +  \file{test-luatex3.tex}{\from{luatex.dtx}{test1,test3}}% +  \file{test-luatex4.tex}{\from{luatex.dtx}{test4}}% +  \file{test-luatex5.tex}{\from{luatex.dtx}{test5}}%  }  \obeyspaces @@ -296,15 +299,337 @@ See source file '\inFileName' for licence and contact information.  %</texpackage>  %    \end{macrocode}  % -%    \section{Test file} +%    \section{Test}  % -%    Very minimal, just check that the package correctly loads. +%    MPG: This section shamelessly copied from Heiko's original +%    \file{luatex.dtx}.  %  %    \begin{macrocode} -%<testplain>\input luatex.sty -%<testlatex>\RequirePackage{luatex} -%<testplain>\bye -%<testlatex>\stop +%<*test2> +\documentclass{article} +\def\LoadCommand{% +  \RequirePackage{luatex}[2010/03/09]% +} +%</test2> +%    \end{macrocode} +%    \begin{macrocode} +%<*test3> +\documentclass{article} +\def\LoadCommand{% +  \RequirePackage{luatex-loader}[2010/03/09]% +} +%</test3> +%    \end{macrocode} +% \subsection{Catcode checks for loading} +% +%    \begin{macrocode} +%<*test1> +%    \end{macrocode} +%    \begin{macrocode} +\catcode`\{=1 % +\catcode`\}=2 % +\catcode`\#=6 % +\catcode`\@=11 % +\expandafter\ifx\csname count@\endcsname\relax +  \countdef\count@=255 % +\fi +\expandafter\ifx\csname @gobble\endcsname\relax +  \long\def\@gobble#1{}% +\fi +\expandafter\ifx\csname @firstofone\endcsname\relax +  \long\def\@firstofone#1{#1}% +\fi +\expandafter\ifx\csname loop\endcsname\relax +  \expandafter\@firstofone +\else +  \expandafter\@gobble +\fi +{% +  \def\loop#1\repeat{% +    \def\body{#1}% +    \iterate +  }% +  \def\iterate{% +    \body +      \let\next\iterate +    \else +      \let\next\relax +    \fi +    \next +  }% +  \let\repeat=\fi +}% +\def\RestoreCatcodes{} +\count@=0 % +\loop +  \edef\RestoreCatcodes{% +    \RestoreCatcodes +    \catcode\the\count@=\the\catcode\count@\relax +  }% +\ifnum\count@<255 % +  \advance\count@ 1 % +\repeat + +\def\RangeCatcodeInvalid#1#2{% +  \count@=#1\relax +  \loop +    \catcode\count@=15 % +  \ifnum\count@<#2\relax +    \advance\count@ 1 % +  \repeat +} +\def\RangeCatcodeCheck#1#2#3{% +  \count@=#1\relax +  \loop +    \ifnum#3=\catcode\count@ +    \else +      \errmessage{% +        Character \the\count@\space +        with wrong catcode \the\catcode\count@\space +        instead of \number#3% +      }% +    \fi +  \ifnum\count@<#2\relax +    \advance\count@ 1 % +  \repeat +} +\def\space{ } +\expandafter\ifx\csname LoadCommand\endcsname\relax +  \def\LoadCommand{\input luatex.sty\relax}% +\fi +\def\Test{% +  \RangeCatcodeInvalid{0}{47}% +  \RangeCatcodeInvalid{58}{64}% +  \RangeCatcodeInvalid{91}{96}% +  \RangeCatcodeInvalid{123}{255}% +  \catcode`\@=12 % +  \catcode`\\=0 % +  \catcode`\%=14 % +  \LoadCommand +  \RangeCatcodeCheck{0}{36}{15}% +  \RangeCatcodeCheck{37}{37}{14}% +  \RangeCatcodeCheck{38}{47}{15}% +  \RangeCatcodeCheck{48}{57}{12}% +  \RangeCatcodeCheck{58}{63}{15}% +  \RangeCatcodeCheck{64}{64}{12}% +  \RangeCatcodeCheck{65}{90}{11}% +  \RangeCatcodeCheck{91}{91}{15}% +  \RangeCatcodeCheck{92}{92}{0}% +  \RangeCatcodeCheck{93}{96}{15}% +  \RangeCatcodeCheck{97}{122}{11}% +  \RangeCatcodeCheck{123}{255}{15}% +  \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +%    \end{macrocode} +%    \begin{macrocode} +%</test1> +%    \end{macrocode} +% +% \subsection{Catcode tables} +% +% \subsubsection{Predefined catcode tables} +% +%    \begin{macrocode} +%<*test4> +\NeedsTeXFormat{LaTeX2e} +%    \end{macrocode} +%    Remember \LaTeX's initial catcodes in count registers +%    starting at \cs{TestLaTeX}. +%    \begin{macrocode} +\count0=0 % +\chardef\TestLaTeX=1000 % +\chardef\TestMax=300 % +\loop +  \count\numexpr\TestLaTeX+\count0\relax=\catcode\count0 % +\ifnum\count0<\TestMax +  \advance\count0 by 1 % +\repeat +\documentclass{minimal} +\usepackage{luatex}[2010/03/09] +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +\makeatletter +\def\Check#1{% +  \Expect*{\the\count@=\the\catcode\count@}% +         *{\the\count@=#1}% +} +\newcount\scratch +\def\Test#1#2{% +  \begin{qstest}{CatcodeTable#1}{CatcodeTable#1}% +    \luatexcatcodetable\csname CatcodeTable#1\endcsname +    \count@=\z@ +    \loop +      \scratch=#2\relax +      \Expect*{\the\count@=\the\catcode\count@}% +             *{\the\count@=\the\scratch}% +    \ifnum\count@<\TestMax +      \advance\count@\@ne +    \repeat +  \end{qstest}% +} +\begingroup +  % luatex-unicode-letters.tex makes some slots to letters +  \def\TestMax{169}% +  \Test{LaTeX}{\the\count\numexpr\TestLaTeX+\count@}% +\endgroup +\Test{String}{\ifnum\count@=32 10\else 12\fi} +\Test{Other}{12} +\luatexinitcatcodetable99 % +\Test{IniTeX}{% +  0\relax +  \begingroup +    \luatexcatcodetable99 % +    \global\scratch=\the\catcode\count@ +  \endgroup +} +%    \end{macrocode} +% +% \subsubsection{Catcode table number stack} +% +%    \begin{macrocode} +\begin{qstest}{CatcodeTableNumStack}{CatcodeTableNumStack} +  \def\TestStack#1{% +    \Expect*{\LuT@NumStack}{#1}% +  }% +  \TestStack{0}% +  \PushCatcodeTableNumStack +  \TestStack{{0}0}% +  \@firstofone{% +    \begingroup +      \luatexinitcatcodetable12 % +      \luatexcatcodetable12 % +      \PushCatcodeTableNumStack +      \TestStack{{12}{0}0}% +      \PopCatcodeTableNumStack +      \TestStack{{0}0}% +      \PopCatcodeTableNumStack +      \TestStack{0}% +      \def\TestWarning{Missing empty stack warning}% +      \def\@PackageWarning#1#2{\def\TestWarning{empty stack}}% +      \PopCatcodeTableNumStack +      \TestStack{0}% +      \Expect*{\TestWarning}{empty stack}% +    \endgroup +  }% +\end{qstest} +%    \end{macrocode} +% +% \subsubsection{Catcode table stack} +% +%    \begin{macrocode} +\begin{qstest}{CatcodeTableStack}{CatcodeTableStack} +  \def\TestStack#1{% +    \Expect*{\the\CatcodeTableStack}{#1}% +  }% +  \TestStack{0}% +  \IncCatcodeTableStack +  \TestStack{2}% +  \IncCatcodeTableStack +  \TestStack{4}% +  \begingroup +    \IncCatcodeTableStack +    \TestStack{6}% +  \endgroup +  \TestStack{6}% +  \begingroup +    \DecCatcodeTableStack +    \TestStack{4}% +  \endgroup +  \TestStack{4}% +  \DecCatcodeTableStack +  \TestStack{2}% +  \DecCatcodeTableStack +  \TestStack{0}% +  \begingroup +    \def\TestError{Missing error}% +    \def\@PackageError#1#2#3{% +      \def\TestError{Empty stack}% +    }% +    \DecCatcodeTableStack +    \TestStack{0}% +    \Expect*{\TestError}{Empty stack}% +  \endgroup +\end{qstest} +%    \end{macrocode} +% +% \subsubsection{Catcode regime macros} +% +%    \begin{macrocode} +\begin{qstest}{CatcodeRegime}{CatcodeRegime} +  \def\TestStacks#1#2#3{% +    \Expect*{\the\luatexcatcodetable}{#1}% +    \Expect*{\the\CatcodeTableStack}{#2}% +    \Expect*{\LuT@NumStack}{#3}% +  }% +  \TestStacks{0}{0}{0}% +  \catcode`\|=7 % +  \BeginCatcodeRegime\CatcodeTableLaTeX +    \TestStacks{2}{2}{{0}0}% +    \Expect*{\the\catcode`\|}{12}% +  \EndCatcodeRegime +  \TestStacks{0}{0}{0}% +  \Expect*{\the\catcode`\|}{7}% +\end{qstest} +%    \end{macrocode} +% +% \subsection{Attribute allocation} +% +%    \begin{macrocode} +\begin{qstest}{Attributes}{Attributes} +  \newattribute\TestAttr +  \Expect*{\meaning\TestAttr}% +         *{\string\attribute\number\allocationnumber}% +  \Expect*{\the\allocationnumber}{0}% +  \begingroup +    \newattribute\TestAttr +    \Expect*{\the\allocationnumber}{1}% +  \endgroup +  \Expect*{\the\allocationnumber}{0}% +  \Expect*{\meaning\TestAttr}*{\string\attribute1}% +  \Expect*{\the\TestAttr}*{\number\LuT@UnsetAttributeValue}% +  \def\Test#1{% +    \setattribute\TestAttr{#1}% +    \Expect*{\the\TestAttr}{#1}% +  }% +  \Test{0}% +  \Test{1}% +  \Test{-1}% +  \Test{123}% +  \unsetattribute\TestAttr +  \Expect*{\the\TestAttr}*{\number\LuT@UnsetAttributeValue}% +  \begingroup +    \Expect*{\the\TestAttr}*{\number\LuT@UnsetAttributeValue}% +    \Test{1234}% +  \endgroup +  \Expect*{\the\TestAttr}*{\number\LuT@UnsetAttributeValue}% +\end{qstest} +%    \end{macrocode} +% +%    \begin{macrocode} +\@@end +%</test4> +%    \end{macrocode} +% +% \subsection{Short test for \plainTeX} +% +%    \begin{macrocode} +%<*test5> +\input luatex.sty\relax +\newattribute\TestAttr +\setattribute\TestAttr{10} +\unsetattribute\TestAttr +\newcatcodetable\TestCTa +\begingroup +  \SetCatcodeRange{`A}{`Z}{12}% +\endgroup +\BeginCatcodeRegime\CatcodeTableLaTeX +\EndCatcodeRegime +\end +%</test5>  %    \end{macrocode}  %  %  | 
