From 6baf5b52e18811f2b44d35a5dcc1a51d6071ce8b Mon Sep 17 00:00:00 2001 From: dakkar Date: Tue, 17 Jul 2007 15:27:31 +0000 Subject: r2493@narval: dakkar | 2007-07-17 10:42:29 +0200 importo il modulo ReST-XML git-svn-id: svn://luxion/repos/Text-Restructured-Writer-LibXML@257 fcb26f47-9200-0410-b104-b98ab5b095f3 --- t/00-load.t | 7 +++++ t/00-pod-coverage.t | 7 +++++ t/00-pod.t | 7 +++++ t/00-prereqs.t | 6 ++++ t/01-basic.t | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 t/00-load.t create mode 100644 t/00-pod-coverage.t create mode 100644 t/00-pod.t create mode 100644 t/00-prereqs.t create mode 100644 t/01-basic.t (limited to 't') diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..f152344 --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,7 @@ +use Test::More tests => 1; + +BEGIN { + use_ok('Text::Restructured::Writer::LibXML'); +} + +diag( "Testing Text::Restructured::Writer::LibXML $Text::Restructured::Writer::LibXML::VERSION" ); diff --git a/t/00-pod-coverage.t b/t/00-pod-coverage.t new file mode 100644 index 0000000..011042e --- /dev/null +++ b/t/00-pod-coverage.t @@ -0,0 +1,7 @@ +use Test::More; +plan skip_all => 'Set DEVEL_TESTS to run these tests' + unless $ENV{DEVEL_TESTS}; +eval "use Test::Pod::Coverage 1.04"; +plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" + if $@; +all_pod_coverage_ok(); diff --git a/t/00-pod.t b/t/00-pod.t new file mode 100644 index 0000000..3681990 --- /dev/null +++ b/t/00-pod.t @@ -0,0 +1,7 @@ +use Test::More; +plan skip_all => 'Set DEVEL_TESTS to run these tests' + unless $ENV{DEVEL_TESTS}; +eval "use Test::Pod 1.14"; +plan skip_all => "Test::Pod 1.14 required for testing POD" + if $@; +all_pod_files_ok(); diff --git a/t/00-prereqs.t b/t/00-prereqs.t new file mode 100644 index 0000000..5bfc2c6 --- /dev/null +++ b/t/00-prereqs.t @@ -0,0 +1,6 @@ +use Test::More; +plan skip_all => 'Set DEVEL_TESTS to run these tests' + unless $ENV{DEVEL_TESTS}; +eval "use Test::Prereq::Build"; +plan skip_all => "Test::Prereq::Build required to test dependencies" if $@; +prereq_ok(); diff --git a/t/01-basic.t b/t/01-basic.t new file mode 100644 index 0000000..94ba201 --- /dev/null +++ b/t/01-basic.t @@ -0,0 +1,79 @@ +use Test::More tests => 10; +use strict; +use warnings; +use Text::Restructured; +use Text::Restructured::Writer::LibXML; +use XML::LibXML::XPathContext; + +my $input=<<'EOF'; +====== + Test +====== +:Author: dakkar + +paragrafo + +link_ + +.. _link: /gino/pino/ + +mathml: :mathml:`x^2` + +.. mathml:: + + (x^2)/(y^2) + +pre:: + + gino pino + rino + +normale + +EOF + +my $opts={ + D => { + generator => 0, + 'source-link' => 0, + 'time' => 0, + }, +}; +my $parser=Text::Restructured->new($opts,'gino'); +my $dudom=$parser->Parse($input,'--inline--'); +my $xdoc=Text::Restructured::Writer::LibXML->new->ProcessDOM($dudom); + +my $ctx=XML::LibXML::XPathContext->new($xdoc); +$ctx->registerNs('m','http://www.w3.org/1998/Math/MathML'); +sub xis { + my ($expr,$val,$comment)=@_; + is $ctx->findvalue($expr), + $val, + $comment||''; +} + +=begin comment + +Test +dakkar +paragrafo +linkmathml: x2x2y2pre: + gino pino +rino +normale + + +=end comment + +=cut + +xis '/document/@source','--inline--','Source name'; +xis '/document/@title','Test','Title'; +xis '/document/docinfo/author',"dakkar\n",'Author'; +xis 'count(/document/paragraph)',6,'Paragraphs'; +xis '/document/paragraph[1]',"paragrafo\n",'para 1'; +xis '/document/paragraph[2]/reference/@refuri','/gino/pino/','Ref'; +xis '/document/paragraph[3]/m:math','x2','MathML 1'; +xis '/document/paragraph[4]/m:math','x2y2','MathML 2'; +xis 'name(/document/paragraph[5]/following-sibling::*[1])','literal_block','Literal'; +xis '/document/literal_block'," gino pino\nrino\n",'Literal content'; -- cgit v1.2.3