Updated tests for chunk options

pull/21/head
Matti Pastell 2014-12-09 11:34:26 +02:00
parent 9e5f7cb1c2
commit 0c9d94d11e
8 changed files with 202 additions and 59 deletions

21
RELEASE.md Normal file
View File

@ -0,0 +1,21 @@
# Release notes for Weave.jl
### Master
* Sandbox module for running code is cleared between documents
* Fixed Latex figure handling (from @wildart)
* Changed "tex" format: separate environment for term chunks
* Improved test coverage
### 0.0.2
8th December 2014
* First release
* Noweb and markdown input formats
* Support for Gadfly, Winston and PyPlot figures
* Term and script chunks
* Support for markdown, tex and rst output

23
test/chunk_options.jl Normal file
View File

@ -0,0 +1,23 @@
using Weave
using Base.Test
#Test chunk options and output formats
weave("documents/chunk_options.noweb", plotlib=nothing)
result = readall(open("documents/chunk_options.md"))
ref = readall(open("documents/chunk_options_ref.md"))
@test result == ref
weave("documents/chunk_options.noweb", doctype="tex", plotlib=nothing)
result = readall(open("documents/chunk_options.tex"))
ref = readall(open("documents/chunk_options_ref.tex"))
@test result == ref
weave("documents/chunk_options.noweb", doctype="texminted", plotlib=nothing)
result = readall(open("documents/chunk_options.tex"))
ref = readall(open("documents/chunk_options_ref.texminted"))
@test result == ref
weave("documents/chunk_options.noweb", doctype="rst", plotlib=nothing)
result = readall(open("documents/chunk_options.rst"))
ref = readall(open("documents/chunk_options_ref.rst"))
@test result == ref

View File

@ -6,21 +6,32 @@ y= [2, 5, 12]
<<>>=
x = [12, 10]
println(y)
println(x)
@
<<echo=false>>=
println("Results without code")
println(x)
@
<<eval=false>>=
y = randn(5)
println("Don't eval, but show code")
@
<<>>=
y = 1:5
println(y)
@
<<results="hidden">>=
a = "Some string"
a = "Don't print me"
println(a)
@
<<results="as_is">>=
println("No markup for results.")
@

View File

@ -16,19 +16,12 @@ julia> y= [2, 5, 12]
~~~~{.julia}
x = [12, 10]
println(y)
println(x)
~~~~~~~~~~~~~
~~~~{.julia}
[2,5,12]
~~~~~~~~~~~~~
~~~~{.julia}
[12,10]
~~~~~~~~~~~~~
@ -37,12 +30,9 @@ println(y)
~~~~{.julia}
a = "Some string"
println(a)
Results without code
[12,10]
~~~~~~~~~~~~~
@ -50,3 +40,43 @@ println(a)
~~~~{.julia}
y = randn(5)
println("Don't eval, but show code")
~~~~~~~~~~~~~
~~~~{.julia}
y = 1:5
println(y)
~~~~~~~~~~~~~
~~~~{.julia}
1:5
~~~~~~~~~~~~~
~~~~{.julia}
a = "Don't print me"
println(a)
~~~~~~~~~~~~~
~~~~{.julia}
println("No markup for results.")
~~~~~~~~~~~~~
No markup for results.

View File

@ -18,12 +18,14 @@
x = [12, 10]
println(y)
println(x)
::
[2,5,12]
[12,10]
@ -33,6 +35,7 @@
::
Results without code
[12,10]
@ -41,12 +44,35 @@
.. code-block:: julia
a = "Some string"
y = randn(5)
println("Don't eval, but show code")
.. code-block:: julia
y = 1:5
println(y)
::
1:5
.. code-block:: julia
a = "Don't print me"
println(a)
@ -54,4 +80,12 @@
.. code-block:: julia
println("No markup for results.")
No markup for results.

View File

@ -14,29 +14,51 @@ julia> y= [2, 5, 12]
\begin{juliacode}
x = [12, 10]
println(y)
println(x)
\end{juliacode}
\begin{juliaout}
[2,5,12]
\end{juliaout}
\begin{juliaout}
[12,10]
\end{juliaout}
\begin{juliaout}
Results without code
[12,10]
\end{juliaout}
\begin{juliacode}
a = "Some string"
y = randn(5)
println("Don't eval, but show code")
\end{juliacode}
\begin{juliacode}
y = 1:5
println(y)
\end{juliacode}
\begin{juliaout}
1:5
\end{juliaout}
\begin{juliacode}
a = "Don't print me"
println(a)
\end{juliacode}
\begin{juliacode}
println("No markup for results.")
\end{juliacode}
No markup for results.

View File

@ -14,29 +14,51 @@ julia> y= [2, 5, 12]
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
x = [12, 10]
println(y)
println(x)
\end{minted}
\begin{minted}[fontsize=\small, xleftmargin=0.5em, mathescape, frame = leftline]{text}
[2,5,12]
\end{minted}
\begin{minted}[fontsize=\small, xleftmargin=0.5em, mathescape, frame = leftline]{text}
[12,10]
\end{minted}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
a = "Some string"
println(a)
\begin{minted}[fontsize=\small, xleftmargin=0.5em, mathescape, frame = leftline]{text}
Results without code
[12,10]
\end{minted}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
y = randn(5)
println("Don't eval, but show code")
\end{minted}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
y = 1:5
println(y)
\end{minted}
\begin{minted}[fontsize=\small, xleftmargin=0.5em, mathescape, frame = leftline]{text}
1:5
\end{minted}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
a = "Don't print me"
println(a)
\end{minted}
\begin{minted}[mathescape, fontsize=\small, xleftmargin=0.5em]{julia}
println("No markup for results.")
\end{minted}
No markup for results.

View File

@ -2,27 +2,7 @@ using Weave
using Base.Test
#Test chunk options and output formats
weave("documents/chunk_options.noweb", plotlib=nothing)
result = readall(open("documents/chunk_options.md"))
ref = readall(open("documents/chunk_options_ref.md"))
@test result == ref
weave("documents/chunk_options.noweb", doctype="tex", plotlib=nothing)
result = readall(open("documents/chunk_options.tex"))
ref = readall(open("documents/chunk_options_ref.tex"))
@test result == ref
weave("documents/chunk_options.noweb", doctype="texminted", plotlib=nothing)
result = readall(open("documents/chunk_options.tex"))
ref = readall(open("documents/chunk_options_ref.texminted"))
@test result == ref
weave("documents/chunk_options.noweb", doctype="rst", plotlib=nothing)
result = readall(open("documents/chunk_options.rst"))
ref = readall(open("documents/chunk_options_ref.rst"))
@test result == ref
include("chunk_options.jl")