From 7444c3b61224192a4d2ec8dbace50dfb97328392 Mon Sep 17 00:00:00 2001 From: Matti Pastell Date: Mon, 22 Dec 2014 17:23:20 +0200 Subject: [PATCH] Added test for asciidoc output --- .gitignore | 2 + .../output/gadfly_formats_test_ref.txt | 82 +++++++++++++++++++ test/gadfly_formats.jl | 6 ++ 3 files changed, 90 insertions(+) create mode 100644 test/documents/output/gadfly_formats_test_ref.txt diff --git a/.gitignore b/.gitignore index f3a9408..cb51d13 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ examples/*.html examples/*.rst examples/*.tex test/documents/figures +test/documents/output/figures +test/documents/output/gadfly_formats_test.txt test/documents/*.tex test/documents/*.md test/documents/*.rst diff --git a/test/documents/output/gadfly_formats_test_ref.txt b/test/documents/output/gadfly_formats_test_ref.txt new file mode 100644 index 0000000..14e8268 --- /dev/null +++ b/test/documents/output/gadfly_formats_test_ref.txt @@ -0,0 +1,82 @@ + + + +[source,julia] +-------------------------------------- +using Gadfly +x = linspace(0, 2π, 200) +plot(x=x, y = sin(x), Geom.line) +-------------------------------------- + + +image::figures/gadfly_formats_test_sin_fun_1.png[width=600,title="sin(x) function."] + + +image::figures/gadfly_formats_test_2_1.png[width=600,title="cos(x) function."] + + +image::figures/gadfly_formats_test_cos2_fun_1.png[width=600] + + + +[source,julia] +-------------------------------------- +julia> x = linspace(0, 2π, 200) +200-element Array{Float64,1}: + 0.0 + 0.0315738 + 0.0631476 + 0.0947214 + 0.126295 + 0.157869 + 0.189443 + 0.221017 + 0.25259 + 0.284164 + ⋮ + 6.03059 + 6.06217 + 6.09374 + 6.12532 + 6.15689 + 6.18846 + 6.22004 + 6.25161 + 6.28319 + +julia> plot(x=x, y = sin(x), Geom.line) + +-------------------------------------- + + +image::figures/gadfly_formats_test_4_1.png[width=600] + + +[source,julia] +-------------------------------------- +julia> y = 20 +20 + +julia> plot(x=x, y = cos(x), Geom.line) + +-------------------------------------- + + +image::figures/gadfly_formats_test_4_2.png[width=600] + + + + +[source,julia] +-------------------------------------- +x = linspace(0, 2π, 200) +plot(x=x, y = sin(x), Geom.line) +y = 20 +plot(x=x, y = cos(x), Geom.line) +-------------------------------------- + + +image::figures/gadfly_formats_test_5_1.png[width=15cm] +image::figures/gadfly_formats_test_5_2.png[width=15cm] + + diff --git a/test/gadfly_formats.jl b/test/gadfly_formats.jl index 33dc33b..2182d4e 100644 --- a/test/gadfly_formats.jl +++ b/test/gadfly_formats.jl @@ -29,3 +29,9 @@ weave("documents/gadfly_formats_test.txt", doctype="rst", plotlib="gadfly") result = readall(open("documents/gadfly_formats_test.rst")) ref = readall(open("documents/gadfly_formats_test_ref.rst")) @test result == ref + +weave("documents/gadfly_formats_test.txt", doctype="asciidoc", plotlib="gadfly", + out_path="documents/output") +result = readall(open("documents/output/gadfly_formats_test.txt")) +ref = readall(open("documents/output/gadfly_formats_test_ref.txt")) +@test result == ref