diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-08-23 20:28:44 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2014-08-23 20:28:44 (GMT) |
commit | a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8 (patch) | |
tree | 0193d9406107790a66098254869e4b070aa6cacc /test/TEX | |
parent | a6ea2d760464092ea91a0dd01ba6260288aa3587 (diff) | |
parent | 6db60dbe1c3dc28f24bfca48135bcb4bc9bd66d6 (diff) | |
download | SCons-a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8.zip SCons-a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8.tar.gz SCons-a7d764ed831fa3243aa0bd3307f641e1e1f9f8a8.tar.bz2 |
Merged default branch into python3-port to keep it up to date.
Hand-updated a few things to keep them python3-safe, and handled
several merge conflicts.
Diffstat (limited to 'test/TEX')
-rw-r--r-- | test/TEX/biblatex_plain.py | 91 | ||||
-rw-r--r-- | test/TEX/synctex.py | 89 | ||||
-rw-r--r-- | test/TEX/variant_dir_newglossary.py | 109 |
3 files changed, 289 insertions, 0 deletions
diff --git a/test/TEX/biblatex_plain.py b/test/TEX/biblatex_plain.py new file mode 100644 index 0000000..68f7cc3 --- /dev/null +++ b/test/TEX/biblatex_plain.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test creation of a Tex document that uses the biblatex package + +Test courtesy Rob Managan. +""" + +import TestSCons +import os + +test = TestSCons.TestSCons() + +latex = test.where_is('pdflatex') +if not latex: + test.skip_test("Could not find 'pdflatex'; skipping test.\n") + +biblatex = os.system('kpsewhich biblatex.sty') +if not biblatex==0: + test.skip_test("biblatex.sty not installed; skipping test(s).\n") + + +test.write(['SConstruct'], """\ +#!/usr/bin/env python + +import os +env = Environment(ENV=os.environ) +main_output = env.PDF(target='biblatextest.pdf', source='biblatextest.tex') +""") + +test.write(['biblatextest.tex'],r""" +\documentclass{article} + +\usepackage{biblatex} + +\begin{document} + +Hello. This is boring. +And even more boring. + +\end{document} +""") + + +test.run() + + +# All (?) the files we expect will get created in the docs directory +files = [ + 'biblatextest.aux', + 'biblatextest.blg', + 'biblatextest.fls', + 'biblatextest.log', + 'biblatextest.pdf', + 'biblatextest.run.xml', +] + +for f in files: + test.must_exist([ f]) + +test.run(arguments = '-c .') + +for f in files: + test.must_not_exist([ f]) + +test.pass_test() + diff --git a/test/TEX/synctex.py b/test/TEX/synctex.py new file mode 100644 index 0000000..867063a --- /dev/null +++ b/test/TEX/synctex.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Validate that use of -synctex command option causes SCons to +be aware of the created synctex.gz file. + +Test configuration contributed by Robert Managan. +""" + +import os +import TestSCons + +test = TestSCons.TestSCons() + +latex = test.where_is('latex') + +if not latex: + test.skip_test("Could not find latex; skipping test(s).\n") + +test.write('SConstruct', """\ +import os +env = Environment() +env.AppendUnique(PDFLATEXFLAGS = '-synctex=1') +env.PDF('mysync', 'mysync.tex') +""") + +test.write('mysync.tex', r""" +\documentclass{article} + +\begin{document} + +This is a simple test of the synctex.gz file. + +\end{document} +""") + +test.run(arguments = '.', stderr=None) + +test.must_exist(test.workpath('mysync.synctex.gz')) +test.must_exist(test.workpath('mysync.aux')) +test.must_exist(test.workpath('mysync.fls')) +test.must_exist(test.workpath('mysync.log')) +test.must_exist(test.workpath('mysync.pdf')) + +test.run(arguments = '-c .') + +x = "Could not remove 'mysync.aux': No such file or directory" +test.must_not_contain_any_line(test.stdout(), [x]) + +test.must_not_exist(test.workpath('mysync.synctex.gz')) +test.must_not_exist(test.workpath('mysync.aux')) +test.must_not_exist(test.workpath('mysync.fls')) +test.must_not_exist(test.workpath('mysync.log')) +test.must_not_exist(test.workpath('mysync.pdf')) + +test.pass_test() + + + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/TEX/variant_dir_newglossary.py b/test/TEX/variant_dir_newglossary.py new file mode 100644 index 0000000..8604270 --- /dev/null +++ b/test/TEX/variant_dir_newglossary.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Validate the use of \newglossary in TeX source files in conjuction +with variant_dir. + +Test configuration contributed by Kendrick Boyd. +""" + +import os +import TestSCons + +test = TestSCons.TestSCons() + +latex = test.where_is('latex') + +if not latex: + test.skip_test("Could not find latex; skipping test(s).\n") + +gloss = os.system('kpsewhich glossaries.sty') +if gloss!=0: + test.skip_test("glossaries.sty not installed; skipping test(s).\n") + + +test.subdir(['src']) + +test.write(['SConstruct'], r""" +import os + +env = Environment(TOOLS = ['tex', 'latex']) +Export(['env']) + +SConscript(os.path.join('src','SConscript'), variant_dir='build/', duplicate=1) +""") + +test.write(['src', 'SConscript'], r""" +Import('env') + +test_pdf = env.PDF(source='test.tex') + +""") + +test.write(['src', 'test.tex'], r""" +\documentclass{report} + +\usepackage{glossaries} + +\newglossary[ntg]{notation}{nts}{nto}{List of Notation} + +\makeglossary + +\newglossaryentry{pi}{type=notation, name={$\pi$}, description={ratio + of circumference to diameter of a circle}} + +\begin{document} + +\glsaddall + +\printglossary[type=notation, style=list] + +\end{document} +""") + +test.run(arguments = '.', stderr = None) + +files = [ + 'test.aux', + 'test.fls', + 'test.glg', + 'test.glo', + 'test.gls', + 'test.ist', + 'test.log', + 'test.ntg', + 'test.nto', + 'test.nts', + 'test.pdf', +] + +for f in files: + test.must_exist(['build',f]) + test.must_not_exist(['src',f]) + + +test.pass_test() |