From aea103a1f2d2604cd5ae6883e6e808930f7ccef4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg@elzevir.fr>
Date: Thu, 11 Mar 2010 16:57:59 +0100
Subject: Add basic test files for attr.

---
 luatexbase-attr.dtx | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)

(limited to 'luatexbase-attr.dtx')

diff --git a/luatexbase-attr.dtx b/luatexbase-attr.dtx
index 8f68efc..4af129c 100644
--- a/luatexbase-attr.dtx
+++ b/luatexbase-attr.dtx
@@ -11,7 +11,8 @@
 %
 % This work consists of the main source file luatexbase-attr.dtx
 % and the derived files
-%    luatexbase-attr.sty luatexbase.attr.lua ...
+%    luatexbase-attr.sty luatexbase.attr.lua
+%   test-regs-plain.tex test-regs-latex.tex
 %
 % Unpacking:
 %    tex luatexbase-attr.dtx
@@ -57,6 +58,12 @@ and the derived files
   \file{luatexbase-attr.sty}{\from{luatexbase-attr.dtx}{texpackage}}%
 }
 
+\generate{%
+  \usedir{doc/luatex/luatexbase}%
+  \file{test-attr-plain.tex}{\from{luatexbase-attr.dtx}{testplain}}%
+  \file{test-attr-latex.tex}{\from{luatexbase-attr.dtx}{testlatex}}%
+}
+
 \def\MetaPrefix{-- }
 
 \def\luapostamble{%
@@ -107,7 +114,7 @@ and the derived files
 %   Dollar        \$     Percent       \%     Ampersand     \&
 %   Acute accent  \'     Left paren    \(     Right paren   \)
 %   Asterisk      \*     Plus          \+     Comma         \,
-   Minus         \-     Point         \.     Solidus       \/
+%   Minus         \-     Point         \.     Solidus       \/
 %   Colon         \:     Semicolon     \;     Less than     \<
 %   Equals        \=     Greater than  \>     Question mark \?
 %   Commercial at \@     Left bracket  \[     Backslash     \\
@@ -115,8 +122,6 @@ and the derived files
 %   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %   Right brace   \}     Tilde         \~}
 %
-% \GetFileInfo{luatexbase-attr.drv}
-%
 % \title{The \pk{luatexbase-attr} package}
 % \date{DATE}
 % \author{%
@@ -153,10 +158,11 @@ and the derived files
     \ifluatex
       \global\luatexattributedef#1=\allocationnumber
     \fi
-    \wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
+    \unsetluatexattribute#1%
     \begingroup\escapechar\m@ne \expandafter\endgroup
     \directlua{luatextra.attributedef_from_tex(
       '\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
+    \wlog{\string#1=\string\luatexattribute\the\allocationnumber}%
   \else
     \errmessage{No room for a new \string\attribute}%
   \fi}
@@ -218,5 +224,28 @@ end
 %</luamodule>
 %    \end{macrocode}
 %
+%    \section{Test files}
+%
+%    The tests done are very basic: we just make sure that the package loads
+%    correctly and the macros don't generate any error, under both LaTeX en
+%    Plain TeX.
+%
+%    \begin{macrocode}
+%<testplain>\input luatexbase-attr.sty
+%<testlatex>\RequirePackage{luatexbase-attr}
+%<*testplain,testlatex>
+\newluatexattribute\testattr
+\setluatexattribute\testattr{1}
+\unsetluatexattribute\testattr
+\begingroup
+\newluatexattribute\anotherattr
+\endgroup
+\setluatexattribute\anotherattr{1}
+%</testplain,testlatex>
+%<testplain>\bye
+%<testlatex>\stop
+%    \end{macrocode}
+%
+%
 % \Finale
 \endinput
-- 
cgit v1.2.3

