slatex test, slatex contracts and props

This commit is contained in:
Jay McCarthy 2010-04-27 11:00:24 -06:00
parent e258476748
commit 5b779d22ac
4 changed files with 72 additions and 2 deletions

View File

@ -1798,6 +1798,7 @@ path/s is either such a string or a list of them.
"collects/tests/scribble" responsible (eli mflatt)
"collects/tests/srfi" responsible (noel chongkai jay)
"collects/tests/srpersist" responsible (unknown)
"collects/tests/slatex" responsible (jay sstrickl)
"collects/tests/syntax-color" responsible (sowens mflatt)
"collects/tests/test-engine" responsible (kathyg)
"collects/tests/unstable/generics.ss" responsible (jay)

View File

@ -1,12 +1,18 @@
(module slatex-wrapper scheme/base
(require mzlib/file
scheme/contract
mzlib/process
mzlib/sendevent
"slatex.ss")
(provide slatex latex pdf-slatex pdf-latex slatex/no-latex
filename->latex-filename)
(provide/contract
[slatex (string? . -> . boolean?)]
[pdf-slatex (string? . -> . boolean?)]
[slatex/no-latex (string? . -> . boolean?)]
[latex (string? . -> . boolean?)]
[pdf-latex (string? . -> . boolean?)]
[filename->latex-filename (string? . -> . string?)])
(define (add-suffix p s)
(path->string

View File

@ -0,0 +1,63 @@
#lang racket
(require slatex/slatex-wrapper
tests/eli-tester
scheme/runtime-path)
(define-runtime-path slatex-file-pth '(lib "slatex"))
(define slatex-pth (path-only slatex-file-pth))
(define tmp-file (build-path (current-directory) "test.tex")
#;(make-temporary-file "slatex~a.tex" #f (current-directory)))
(test
(putenv "TEXINPUTS" (format "~a:" (path->string slatex-pth)))
tmp-file
(with-output-to-file tmp-file #:exists 'truncate/replace
(lambda ()
(display #<<END
\documentclass{article}
\usepackage{slatex}
%
%That was LaTeX2e. If you use
%LaTeX2.09, or LaTeX2e in
%2.09 compatibility mode, use
%
%\documentstyle[slatex]{article}
%
%or
%
%\documentstyle{article}
%\input slatex.sty
\begin{document}
In Scheme, the expression
\scheme|(set! x 42)| returns
an unspecified value, rather
than \scheme'42'. However,
one could get a \scheme{set!}
of the latter style with:
\begin{schemedisplay}
(define-syntax setq
(syntax-rules ()
[(setq x a)
(begin (set! x a)
x)]))
\end{schemedisplay}
\end{document}
END
)))
(slatex (path->string tmp-file))
(with-handlers ([exn:fail:filesystem? void])
(delete-file (path-replace-suffix tmp-file #".aux")))
(with-handlers ([exn:fail:filesystem? void])
(delete-file (path-replace-suffix tmp-file #".log")))
(with-handlers ([exn:fail:filesystem? void])
(delete-file (path-replace-suffix tmp-file #".dvi")))
(delete-file tmp-file))