tests: Replace texlive importer tests.
* tests/texlive.scm (xml, sxml): Remove variables. ("fetch-sxml: returns SXML for valid XML", "sxml->package"): Remove tests. ("texlive->guix-package"): Add new test.
This commit is contained in:
parent
424f2c92b4
commit
f66da037b4
@ -30,87 +30,174 @@
|
|||||||
|
|
||||||
(test-begin "texlive")
|
(test-begin "texlive")
|
||||||
|
|
||||||
(define xml
|
(define %fake-tlpdb
|
||||||
"\
|
'(("stricttex"
|
||||||
<entry id=\"foo\">
|
. ((name
|
||||||
<name>foo</name>
|
. "stricttex")
|
||||||
<caption>Foomatic frobnication in LuaLaTeX</caption>
|
(shortdesc
|
||||||
<authorref id=\"rekado\"/>
|
. "Strictly balanced brackets and numbers in command names")
|
||||||
<license type=\"lppl1.3\"/>
|
(longdesc
|
||||||
<version number=\"2.6a\"/>
|
. "This is a small, LuaLaTeX-only package providing you with three,
|
||||||
<description>
|
sometimes useful features: It allows you to make brackets [...] \"strict\",
|
||||||
<p>
|
meaning that each [ must be balanced by a ]. It allows you to use numbers in
|
||||||
Foo is a package for LuaLaTeX. It provides an interface to frobnicate gimbals
|
command names, so that you can do stuff like \\newcommand\\pi12{\\pi_{12}}. It
|
||||||
in a foomatic way with the LuaTeX engine.
|
allows you to use numbers and primes in command names, so that you can do
|
||||||
</p>
|
stuff like \\newcommand\\pi'12{\\pi '_{12}}.")
|
||||||
<p>
|
(docfiles
|
||||||
The package requires the bar and golly
|
. ("texmf-dist/doc/lualatex/stricttex/README.md"
|
||||||
bundles for extremely special specialties.
|
"texmf-dist/doc/lualatex/stricttex/stricttex.pdf"))
|
||||||
</p>
|
(runfiles
|
||||||
</description>
|
. ("texmf-dist/tex/lualatex/stricttex/stricttex.lua"
|
||||||
<ctan path=\"/macros/latex/contrib/foo\" file=\"true\"/>
|
"texmf-dist/tex/lualatex/stricttex/stricttex.sty"))
|
||||||
<texlive location=\"foo\"/>
|
(catalogue-license . "lppl1.3c")))
|
||||||
<keyval key=\"topic\" value=\"tests\"/>
|
("texsis"
|
||||||
null
|
. ((name
|
||||||
</entry>")
|
. "texsis")
|
||||||
|
(shortdesc
|
||||||
|
. "Plain TeX macros for Physicists")
|
||||||
|
(longdesc
|
||||||
|
. "TeXsis is a TeX macro package which provides useful features for
|
||||||
|
typesetting research papers and related documents. For example, it includes
|
||||||
|
support specifically for: Automatic numbering of equations, figures, tables
|
||||||
|
and references; Simplified control of type sizes, line spacing, footnotes,
|
||||||
|
running headlines and footlines, and tables of contents, figures and tables;
|
||||||
|
Specialized document formats for research papers, preprints and \"e-prints\",
|
||||||
|
conference proceedings, theses, books, referee reports, letters, and
|
||||||
|
memoranda; Simplified means of constructing an index for a book or thesis;
|
||||||
|
Easy to use double column formatting; Specialized environments for lists,
|
||||||
|
theorems and proofs, centered or non-justified text, and listing computer
|
||||||
|
code; Specialized macros for easily constructing ruled tables. TeXsis was
|
||||||
|
originally developed for physicists, but others may also find it useful. It is
|
||||||
|
completely compatible with Plain TeX.")
|
||||||
|
(depend . ("cm" "hyphen-base" "knuth-lib" "plain" "tex"))
|
||||||
|
(docfiles
|
||||||
|
. ("texmf-dist/doc/man/man1/texsis.1"
|
||||||
|
"texmf-dist/doc/man/man1/texsis.man1.pdf"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/COPYING"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Example.tex"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Fonts.tex"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/INSTALL"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Install.tex"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/MANIFEST"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Manual.fgl"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Manual.ref"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Manual.tbl"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/Manual.tex"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/NEWS"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/README"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSapxF.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXScover.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSdcol.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSdoc.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSdoc0.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSdocM.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSend.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSenvmt.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSeqns.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSfigs.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSfmts.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSfonts.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSinstl.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSintro.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSletr.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSmisc.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSprns.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSrefs.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSrevs.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSruled.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSsects.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSsite.000"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXSsymb.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/TXStags.doc"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/index.tex"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/letr"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/penguin.eps"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/penguin2.eps"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/texsis.el"
|
||||||
|
"texmf-dist/doc/otherformats/texsis/base/texsis.lsm"))
|
||||||
|
(runfiles
|
||||||
|
. ("texmf-dist/bibtex/bst/texsis/texsis.bst"
|
||||||
|
"texmf-dist/tex/texsis/base/AIP.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/CVformat.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/Elsevier.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/Exam.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/Formletr.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/IEEE.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/PhysRev.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/Spanish.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/Swedish.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSconts.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSdcol.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSenvmt.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSeqns.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSfigs.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSfmts.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSfonts.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXShead.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSinit.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSletr.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSmacs.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSmemo.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSprns.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSrefs.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSruled.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSsects.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSsite.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXSsymb.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXStags.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/TXStitle.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/Tablebod.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/WorldSci.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/color.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/nuclproc.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/printfont.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/spine.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/texsis.tex"
|
||||||
|
"texmf-dist/tex/texsis/base/thesis.txs"
|
||||||
|
"texmf-dist/tex/texsis/base/twin.txs"
|
||||||
|
"texmf-dist/tex/texsis/config/texsis.ini"))
|
||||||
|
(catalogue-license . "lppl")))))
|
||||||
|
|
||||||
(define sxml
|
(test-assert "texlive->guix-package"
|
||||||
'(*TOP* (entry (@ (id "foo"))
|
|
||||||
(name "foo")
|
|
||||||
(caption "Foomatic frobnication in LuaLaTeX")
|
|
||||||
(authorref (@ (id "rekado")))
|
|
||||||
(license (@ (type "lppl1.3")))
|
|
||||||
(version (@ (number "2.6a")))
|
|
||||||
(description
|
|
||||||
(p "\n Foo is a package for LuaLaTeX. It provides an interface to frobnicate gimbals\n in a foomatic way with the LuaTeX engine.\n ")
|
|
||||||
(p "\n The package requires the bar and golly\n bundles for extremely special specialties.\n "))
|
|
||||||
(ctan (@ (path "/macros/latex/contrib/foo") (file "true")))
|
|
||||||
(texlive (@ (location "foo")))
|
|
||||||
(keyval (@ (value "tests") (key "topic")))
|
|
||||||
"\n null\n")))
|
|
||||||
|
|
||||||
(test-equal "fetch-sxml: returns SXML for valid XML"
|
|
||||||
sxml
|
|
||||||
(with-http-server `((200 ,xml))
|
|
||||||
(parameterize ((current-http-proxy (%local-url)))
|
|
||||||
(fetch-sxml "foo"))))
|
|
||||||
|
|
||||||
;; TODO:
|
|
||||||
(test-assert "sxml->package"
|
|
||||||
;; Replace network resources with sample data.
|
;; Replace network resources with sample data.
|
||||||
(mock ((guix build svn) svn-fetch
|
(mock ((guix build svn) svn-fetch
|
||||||
(lambda* (url revision directory
|
(lambda* (url revision directory
|
||||||
#:key (svn-command "svn")
|
#:key (svn-command "svn")
|
||||||
(user-name #f)
|
(user-name #f)
|
||||||
(password #f))
|
(password #f)
|
||||||
|
(recursive? #t))
|
||||||
(mkdir-p directory)
|
(mkdir-p directory)
|
||||||
(with-output-to-file (string-append directory "/foo")
|
(with-output-to-file (string-append directory "/foo")
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(display "source")))))
|
(display "source")))))
|
||||||
(let ((result (sxml->package sxml)))
|
(let ((result (texlive->guix-package "texsis"
|
||||||
|
#:package-database
|
||||||
|
(lambda _ %fake-tlpdb))))
|
||||||
(match result
|
(match result
|
||||||
(('package
|
(('package
|
||||||
('name "texlive-latex-foo")
|
('inherit ('simple-texlive-package
|
||||||
('version "2.6a")
|
"texlive-texsis"
|
||||||
('source ('origin
|
('list "doc/man/man1/"
|
||||||
('method 'svn-fetch)
|
"doc/otherformats/texsis/base/"
|
||||||
('uri ('texlive-ref "latex" "foo"))
|
"bibtex/bst/texsis/"
|
||||||
('sha256
|
"tex/texsis/base/"
|
||||||
('base32
|
"tex/texsis/config/")
|
||||||
(? string? hash)))))
|
('base32 (? string? hash))
|
||||||
('build-system 'texlive-build-system)
|
#:trivial? #t))
|
||||||
('arguments ('quote (#:tex-directory "latex/foo")))
|
('propagated-inputs
|
||||||
('home-page "http://www.ctan.org/pkg/foo")
|
(("texlive-cm" ',texlive-cm)
|
||||||
('synopsis "Foomatic frobnication in LuaLaTeX")
|
("texlive-hyphen-base" ',texlive-hyphen-base)
|
||||||
('description
|
("texlive-knuth-lib" ',texlive-knuth-lib)
|
||||||
"Foo is a package for LuaLaTeX. It provides an interface to \
|
("texlive-plain" ',texlive-plain)
|
||||||
frobnicate gimbals in a foomatic way with the LuaTeX engine. The package \
|
("texlive-tex" ',texlive-tex)))
|
||||||
requires the bar and golly bundles for extremely special specialties.")
|
('home-page "https://www.tug.org/texlive/")
|
||||||
('license 'lppl1.3+))
|
('synopsis "Plain TeX macros for Physicists")
|
||||||
#t)
|
('description (? string? description))
|
||||||
|
('license 'lppl))
|
||||||
|
#true)
|
||||||
(_
|
(_
|
||||||
(begin
|
(begin
|
||||||
(format #t "~s\n" result)
|
(format #t "~s~%" result)
|
||||||
(pk 'fail result #f)))))))
|
(pk 'fail result #f)))))))
|
||||||
|
|
||||||
(test-end "texlive")
|
(test-end "texlive")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user