[latex3-commits] [git/LaTeX3-latex3-latex2e] gh479: Add rollback test file for \NewModuleRelease (c3665892)

PhelypeOleinik phelype.oleinik at latex-project.org
Thu Mar 18 01:38:50 CET 2021


Repository : https://github.com/latex3/latex2e
On branch  : gh479
Link       : https://github.com/latex3/latex2e/commit/c3665892eaa8d5048c04e1b1e70d77cc419690a9

>---------------------------------------------------------------

commit c3665892eaa8d5048c04e1b1e70d77cc419690a9
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Wed Mar 17 21:38:50 2021 -0300

    Add rollback test file for \NewModuleRelease


>---------------------------------------------------------------

c3665892eaa8d5048c04e1b1e70d77cc419690a9
 base/testfiles/github-0479b.lvt | 142 ++++++++++++++++++++++++++++++++++++++++
 base/testfiles/github-0479b.tlg | 123 ++++++++++++++++++++++++++++++++++
 2 files changed, 265 insertions(+)

diff --git a/base/testfiles/github-0479b.lvt b/base/testfiles/github-0479b.lvt
new file mode 100644
index 00000000..9e5a493b
--- /dev/null
+++ b/base/testfiles/github-0479b.lvt
@@ -0,0 +1,142 @@
+\makeatletter
+\let\NeedsTeXFormat at saved\NeedsTeXFormat
+\def\unloadlatexrelease#1{%
+  \expandafter\let\csname ver at test-latexrelease.sty\endcsname\@undefined
+  % change IIR -> IIR2 so that IncludeRelease thinks nothing has been applied in the past
+  % need to sneed that in as the definition is inside the package, so hook on \NeedTeXFormat
+  \def\NeedsTeXFormat{%
+  \def\@IncludeInRele at se####1####2####3{%
+    \toks@{[####1] ####3}%
+    \expandafter\ifx\csname\string####2+\@currname+IIR#1\endcsname\relax
+      \ifnum\expandafter\@parse at version####1//00\@nil
+            >\expandafter\@parse at version\fmtversion//00\@nil
+        \GenericInfo{}{Skipping: \the\toks@}%
+       \expandafter\expandafter\expandafter\@gobble at IncludeInRelease
+      \else
+        \GenericInfo{}{Applying: \the\toks@}%
+        \@includeinreleasetrue
+        \expandafter\let\csname\string####2+\@currname+IIR#1\endcsname\@empty
+      \fi
+    \else
+      \GenericInfo{}{Already applied: \the\toks@}%
+      \expandafter\@gobble at IncludeInRelease
+    \fi
+  }%
+  \NeedsTeXFormat at saved}
+}
+
+\input{test2e}
+
+% Faking LaTeX 2021-11-01
+\def\fmtversion{2021-11-01}
+\def\reserved at a#1-#2-#3-{#1#2#3}
+\edef\sourceLaTeXdate{\expandafter\reserved at a\fmtversion- }
+
+% Code (supposedly) built into the kernel:
+\ExplSyntaxOn
+\cs_new:Npn \__internal_A: { changed~internal }
+\cs_new:Npn \A { \__internal_A: }
+\cs_new:Npn \B { altered }
+\cs_new:Npn \C { meeto }
+\cs_new:Npn \D { }
+\ExplSyntaxOff
+
+\begin{filecontents}{test-latexrelease.sty}
+% \begin{steal code from latexrelease.sty}
+% This piece of unreadability grabs the initialisation code
+% in latexrelease.sty and ignores the actual LaTeX release
+% patches.  Then we add below our own "LaTeX release" code
+% to test.
+\let\ltxendinput\endinput
+\long\def\endinput#1\endofthisfile{}
+\let\endofthisfile\relax
+\begingroup
+  \catcode`\^^@=12
+  \everyeof{\stopstop\expandafter\x\noexpand}%
+  \long\def\x#1\edef\latexreleaseversion#2#3%
+          \let\currentLaTeXdate\requestedLaTeXdate#4\stopstop{%
+    \edef\x{\endgroup\unexpanded{\edef\x{%   V\--------V change date
+      \unexpanded{#1\edef\latexreleaseversion{\fmtversion}#3%
+          \let\currentLaTeXdate\requestedLaTeXdate}}}}}%
+  \expandafter\expandafter\expandafter\x\@@input latexrelease.sty \relax
+\x
+% \end{steal code from latexrelease.sty}
+
+% Extracted latexrelease.sty blocks:
+\ExplSyntaxOn
+\NewModuleRelease{lttestmodule}{2020/10/01}
+
+% -----------------------------------------
+% \cs_new:Npn \__internal_A: { original }
+\cs_new:Npn \A { \__internal_A: }
+
+\IncludeInRelease{2021/11/01}{\__internal_A:}{change~\__internal_A:}
+\cs_gset:Npn \__internal_A: { changed~internal }
+\EndIncludeInRelease
+\IncludeInRelease{2021/05/01}{\__internal_A:}{change~\__internal_A:}
+\cs_gset:Npn \__internal_A: { previous~version }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\__internal_A:}{change~\__internal_A:}
+\cs_gset:Npn \__internal_A: { original }
+\EndIncludeInRelease
+
+% -----------------------------------------
+% \cs_new:Npn \B { }
+
+\IncludeInRelease{2021/05/01}{\B}{change~\B}
+\cs_gset:Npn \B { altered }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\B}{change~\B}
+\cs_gset:Npn \B { }
+\EndIncludeInRelease
+
+% -----------------------------------------
+% \cs_new:Npn \C { }
+
+\IncludeInRelease{2021/11/01}{\C}{change~\C}
+\cs_gset:Npn \C { metoo }
+\EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\C}{change~\C}
+\cs_gset:Npn \C { }
+\EndIncludeInRelease
+
+\cs_new:Npn \D { }
+
+% -----------------------------------------
+\IncludeInRelease{0000/00/00}{lttestmodule}{Undo~module}
+% Only undo public commands
+
+\cs_undefine:N \A
+\cs_undefine:N \B
+\cs_undefine:N \C
+\cs_undefine:N \D
+
+\EndModuleRelease
+\ExplSyntaxOff
+
+\endofthisfile
+\let\endinput\ltxendinput
+\end{filecontents}
+%%% --------------------------------------------------------------------
+
+\START
+
+\RequirePackage[current]{test-latexrelease}
+\edef\x{\A}\show\x \show\B \show\C \show\D
+
+\unloadlatexrelease{1}
+
+\RequirePackage[2021-05-01]{test-latexrelease}
+\edef\x{\A}\show\x \show\B \show\C \show\D
+
+\unloadlatexrelease{2}
+
+\RequirePackage[2020-10-01]{test-latexrelease}
+\edef\x{\A}\show\x \show\B \show\C \show\D
+
+\unloadlatexrelease{3}
+
+\RequirePackage[2020-02-02]{test-latexrelease}
+\edef\x{\A}\show\x \show\B \show\C \show\D
+
+\END
diff --git a/base/testfiles/github-0479b.tlg b/base/testfiles/github-0479b.tlg
new file mode 100644
index 00000000..79717160
--- /dev/null
+++ b/base/testfiles/github-0479b.tlg
@@ -0,0 +1,123 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(test-latexrelease.sty (latexrelease.sty)
+LaTeX Info: Redefining \IfTargetDateBefore on input line ....
+LaTeX Warning: You have requested package `test-latexrelease',
+               but the package provides `latexrelease'.
+Package: latexrelease ....-..-.. v... LaTeX release emulation and tests (including releases up to ....-..-..)
+Package latexrelease Warning: Current format date selected, no patches applied.
+)
+> \x=macro:
+->changed internal.
+l. ...\edef\x{\A}\show\x
+                         \show\B \show\C \show\D
+> \B=\long macro:
+->altered.
+l. ...\edef\x{\A}\show\x \show\B
+                                 \show\C \show\D
+> \C=\long macro:
+->meeto.
+l. ...\edef\x{\A}\show\x \show\B \show\C
+                                         \show\D
+> \D=\long macro:
+->.
+l. ...\edef\x{\A}\show\x \show\B \show\C \show\D
+(test-latexrelease.sty (latexrelease.sty)
+LaTeX Info: Redefining \IfTargetDateBefore on input line ....
+LaTeX Warning: You have requested package `test-latexrelease',
+               but the package provides `latexrelease'.
+Package: latexrelease ....-..-.. v... LaTeX release emulation and tests (including releases up to ....-..-..)
+BEGIN module: lttestmodule (....-..-..) on input line ....
+Skipping module lttestmodule on input line ....
+Skipping: [....-..-..] change \__internal_A:  on input line ....
+Applying: [....-..-..] change \__internal_A:  on input line ....
+Already applied: [....-..-..] change \__internal_A:  on input line ....
+Applying: [....-..-..] change \B  on input line ....
+Already applied: [....-..-..] change \B  on input line ....
+Skipping: [....-..-..] change \C  on input line ....
+Applying: [....-..-..] change \C  on input line ....
+END module: lttestmodule (....-..-..) on input line ....
+)
+> \x=macro:
+->previous version.
+l. ...\edef\x{\A}\show\x
+                         \show\B \show\C \show\D
+> \B=\long macro:
+->altered.
+l. ...\edef\x{\A}\show\x \show\B
+                                 \show\C \show\D
+> \C=\long macro:
+->.
+l. ...\edef\x{\A}\show\x \show\B \show\C
+                                         \show\D
+> \D=\long macro:
+->.
+l. ...\edef\x{\A}\show\x \show\B \show\C \show\D
+(test-latexrelease.sty (latexrelease.sty)
+LaTeX Info: Redefining \IfTargetDateBefore on input line ....
+LaTeX Warning: You have requested package `test-latexrelease',
+               but the package provides `latexrelease'.
+Package: latexrelease ....-..-.. v... LaTeX release emulation and tests (including releases up to ....-..-..)
+BEGIN module: lttestmodule (....-..-..) on input line ....
+Skipping module lttestmodule on input line ....
+Skipping: [....-..-..] change \__internal_A:  on input line ....
+Skipping: [....-..-..] change \__internal_A:  on input line ....
+Applying: [....-..-..] change \__internal_A:  on input line ....
+Skipping: [....-..-..] change \B  on input line ....
+Applying: [....-..-..] change \B  on input line ....
+Skipping: [....-..-..] change \C  on input line ....
+Applying: [....-..-..] change \C  on input line ....
+END module: lttestmodule (....-..-..) on input line ....
+)
+> \x=macro:
+->original.
+l. ...\edef\x{\A}\show\x
+                         \show\B \show\C \show\D
+> \B=\long macro:
+->.
+l. ...\edef\x{\A}\show\x \show\B
+                                 \show\C \show\D
+> \C=\long macro:
+->.
+l. ...\edef\x{\A}\show\x \show\B \show\C
+                                         \show\D
+> \D=\long macro:
+->.
+l. ...\edef\x{\A}\show\x \show\B \show\C \show\D
+(test-latexrelease.sty (latexrelease.sty)
+LaTeX Info: Redefining \IfTargetDateBefore on input line ....
+LaTeX Warning: You have requested package `test-latexrelease',
+               but the package provides `latexrelease'.
+Package: latexrelease ....-..-.. v... LaTeX release emulation and tests (including releases up to ....-..-..)
+BEGIN module: lttestmodule (....-..-..) on input line ....
+Skipping module lttestmodule on input line ....
+Skipping: [....-..-..] change \__internal_A:  on input line ....
+Skipping: [....-..-..] change \__internal_A:  on input line ....
+Skipping: [....-..-..] change \__internal_A:  on input line ....
+Skipping: [....-..-..] change \B  on input line ....
+Skipping: [....-..-..] change \B  on input line ....
+Skipping: [....-..-..] change \C  on input line ....
+Skipping: [....-..-..] change \C  on input line ....
+Applying: [....-..-..] Undo module on input line ....
+END module: lttestmodule (....-..-..) on input line ....
+)
+! Undefined control sequence.
+l. ...\edef\x{\A
+                }\show\x \show\B \show\C \show\D
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+> \x=macro:
+->.
+l. ...\edef\x{\A}\show\x
+                         \show\B \show\C \show\D
+> \B=undefined.
+l. ...\edef\x{\A}\show\x \show\B
+                                 \show\C \show\D
+> \C=undefined.
+l. ...\edef\x{\A}\show\x \show\B \show\C
+                                         \show\D
+> \D=undefined.
+l. ...\edef\x{\A}\show\x \show\B \show\C \show\D





More information about the latex3-commits mailing list.