From 01cb97d37f6138597c4bc61911241ad4ab500727 Mon Sep 17 00:00:00 2001 From: Kevin Scaldeferri Date: Tue, 25 Jul 2006 23:08:51 +0000 Subject: [PATCH] added initial test suite version --- t/driver.t | 61 ++++++++++++++++++++++++++++ t/t-permalinks/data/foo/bar.txt | 4 ++ t/t-permalinks/data/foo/baz.txt | 8 ++++ t/t-permalinks/expected.bar | 30 ++++++++++++++ t/t-permalinks/expected.html | 42 +++++++++++++++++++ t/t-permalinks/expected.rss | 34 ++++++++++++++++ t/t-permalinks/spec.yaml | 16 ++++++++ t/t-smoketest/data/1.txt | 16 ++++++++ t/t-smoketest/expected.html | 42 +++++++++++++++++++ t/t-smoketest/expected.rss | 34 ++++++++++++++++ t/t-smoketest/spec.yaml | 7 ++++ t/t-templates/data/1.txt | 16 ++++++++ t/t-templates/data/content_type.html | 1 + t/t-templates/data/date.html | 1 + t/t-templates/data/foot.html | 3 ++ t/t-templates/data/head.html | 11 +++++ t/t-templates/data/story.html | 3 ++ t/t-templates/expected.html | 34 ++++++++++++++++ t/t-templates/expected.rss | 34 ++++++++++++++++ t/t-templates/spec.yaml | 4 ++ 20 files changed, 401 insertions(+) create mode 100755 t/driver.t create mode 100644 t/t-permalinks/data/foo/bar.txt create mode 100644 t/t-permalinks/data/foo/baz.txt create mode 100644 t/t-permalinks/expected.bar create mode 100644 t/t-permalinks/expected.html create mode 100644 t/t-permalinks/expected.rss create mode 100644 t/t-permalinks/spec.yaml create mode 100644 t/t-smoketest/data/1.txt create mode 100644 t/t-smoketest/expected.html create mode 100644 t/t-smoketest/expected.rss create mode 100644 t/t-smoketest/spec.yaml create mode 100644 t/t-templates/data/1.txt create mode 100644 t/t-templates/data/content_type.html create mode 100644 t/t-templates/data/date.html create mode 100644 t/t-templates/data/foot.html create mode 100644 t/t-templates/data/head.html create mode 100644 t/t-templates/data/story.html create mode 100644 t/t-templates/expected.html create mode 100644 t/t-templates/expected.rss create mode 100644 t/t-templates/spec.yaml diff --git a/t/driver.t b/t/driver.t new file mode 100755 index 0000000..7e12204 --- /dev/null +++ b/t/driver.t @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More qw( no_plan ); + +use File::Copy; +use File::Compare; +use Cwd; +use YAML; + + +my $orig_cwd = cwd(); + +opendir(my $dh, $orig_cwd) or die("Opendir failed: $!"); + +my @tests = grep { /^t-/ } readdir $dh; + +for my $testdir (@tests) { + my (undef, $test) = split /-/, $testdir, 2; + + chdir $testdir; + my $cwd = cwd(); + + my $spec = YAML::LoadFile ("spec.yaml"); + + if (! $spec) { + fail ("$test - loading spec"); + next; + } + + my $success = 1; + + copy("../../blosxom.cgi", ".") or die("Copy failed: $!"); + chmod(0777, "blosxom.cgi"); + + system("perl -pi -e 's{/Library/WebServer/Documents/blosxom}{$cwd/data}' blosxom.cgi") == 0 + or die "$!"; + + for (@{$spec->{tests}}) { + my ($args, $output) = @$_; + + system("./blosxom.cgi $args > ${output}.got") == 0 + or die "$!"; + + if (ok(compare("${output}.got", $output) == 0, + "$test - Got expected output for args [$args]")) { + unlink("${output}.got"); + } else { + $success = 0; + } + } + + if ($success) { + unlink("blosxom.cgi"); + } + + chdir $orig_cwd; +} + diff --git a/t/t-permalinks/data/foo/bar.txt b/t/t-permalinks/data/foo/bar.txt new file mode 100644 index 0000000..1e06cbd --- /dev/null +++ b/t/t-permalinks/data/foo/bar.txt @@ -0,0 +1,4 @@ +Lorem ipsum +Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. diff --git a/t/t-permalinks/data/foo/baz.txt b/t/t-permalinks/data/foo/baz.txt new file mode 100644 index 0000000..f946d24 --- /dev/null +++ b/t/t-permalinks/data/foo/baz.txt @@ -0,0 +1,8 @@ +Lorem ipso +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor. diff --git a/t/t-permalinks/expected.bar b/t/t-permalinks/expected.bar new file mode 100644 index 0000000..7b788c3 --- /dev/null +++ b/t/t-permalinks/expected.bar @@ -0,0 +1,30 @@ +Content-Type: text/html; charset=ISO-8859-1 + + + + + My Weblog + + + +
+ My Weblog
+ +
+

+

Tue, 25 Jul 2006

+

+ Lorem ipsum
+ Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto.
+
+ posted at: 11:02 | path: /foo | permanent link to this entry +

+ +

+

+ +
+ + diff --git a/t/t-permalinks/expected.html b/t/t-permalinks/expected.html new file mode 100644 index 0000000..e63a481 --- /dev/null +++ b/t/t-permalinks/expected.html @@ -0,0 +1,42 @@ +Content-Type: text/html; charset=ISO-8859-1 + + + + + My Weblog + + + +
+ My Weblog
+ +
+

+

Tue, 25 Jul 2006

+

+ Lorem ipso
+ Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor.
+
+ posted at: 11:03 | path: /foo | permanent link to this entry +

+

+ Lorem ipsum
+ Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto.
+
+ posted at: 11:02 | path: /foo | permanent link to this entry +

+ +

+

+ +
+ + diff --git a/t/t-permalinks/expected.rss b/t/t-permalinks/expected.rss new file mode 100644 index 0000000..a03fc8a --- /dev/null +++ b/t/t-permalinks/expected.rss @@ -0,0 +1,34 @@ +Content-Type: text/xml; charset=ISO-8859-1 + + + + + + + + My Weblog + http://localhost/./blosxom.cgi + Yet another Blosxom weblog. + en + + + Lorem ipsum + http://localhost/./blosxom.cgi/2006/07/19#1 + Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor. + + + diff --git a/t/t-permalinks/spec.yaml b/t/t-permalinks/spec.yaml new file mode 100644 index 0000000..586588b --- /dev/null +++ b/t/t-permalinks/spec.yaml @@ -0,0 +1,16 @@ +tests: + - + - "" + - expected.html + - + - /foo + - expected.html + - + - /foo#bar + - expected.html + - + - /foo/bar.html + - expected.bar +# - +# - /2006/07/25/bar.html +# - expected.bar diff --git a/t/t-smoketest/data/1.txt b/t/t-smoketest/data/1.txt new file mode 100644 index 0000000..ea2a941 --- /dev/null +++ b/t/t-smoketest/data/1.txt @@ -0,0 +1,16 @@ +Lorem ipsum +Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor. diff --git a/t/t-smoketest/expected.html b/t/t-smoketest/expected.html new file mode 100644 index 0000000..9843135 --- /dev/null +++ b/t/t-smoketest/expected.html @@ -0,0 +1,42 @@ +Content-Type: text/html; charset=ISO-8859-1 + + + + + My Weblog + + + +
+ My Weblog
+ +
+

+

Wed, 19 Jul 2006

+

+ Lorem ipsum
+ Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor.
+
+ posted at: 22:54 | path: | permanent link to this entry +

+ +

+

+ +
+ + diff --git a/t/t-smoketest/expected.rss b/t/t-smoketest/expected.rss new file mode 100644 index 0000000..a03fc8a --- /dev/null +++ b/t/t-smoketest/expected.rss @@ -0,0 +1,34 @@ +Content-Type: text/xml; charset=ISO-8859-1 + + + + + + + + My Weblog + http://localhost/./blosxom.cgi + Yet another Blosxom weblog. + en + + + Lorem ipsum + http://localhost/./blosxom.cgi/2006/07/19#1 + Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor. + + + diff --git a/t/t-smoketest/spec.yaml b/t/t-smoketest/spec.yaml new file mode 100644 index 0000000..02f8989 --- /dev/null +++ b/t/t-smoketest/spec.yaml @@ -0,0 +1,7 @@ +tests: + - + - "" + - expected.html + - + - "flav=rss" + - "expected.rss" diff --git a/t/t-templates/data/1.txt b/t/t-templates/data/1.txt new file mode 100644 index 0000000..ea2a941 --- /dev/null +++ b/t/t-templates/data/1.txt @@ -0,0 +1,16 @@ +Lorem ipsum +Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor. diff --git a/t/t-templates/data/content_type.html b/t/t-templates/data/content_type.html new file mode 100644 index 0000000..e81f92a --- /dev/null +++ b/t/t-templates/data/content_type.html @@ -0,0 +1 @@ +text/xhtml; charset=UTF-8 diff --git a/t/t-templates/data/date.html b/t/t-templates/data/date.html new file mode 100644 index 0000000..2cdf76d --- /dev/null +++ b/t/t-templates/data/date.html @@ -0,0 +1 @@ +

$yr-$mo_num-$da

diff --git a/t/t-templates/data/foot.html b/t/t-templates/data/foot.html new file mode 100644 index 0000000..5179ade --- /dev/null +++ b/t/t-templates/data/foot.html @@ -0,0 +1,3 @@ + + + diff --git a/t/t-templates/data/head.html b/t/t-templates/data/head.html new file mode 100644 index 0000000..47130be --- /dev/null +++ b/t/t-templates/data/head.html @@ -0,0 +1,11 @@ + + + + + $blog_title $path_info_da $path_info_mo $path_info_yr + + + +

$blog_title

+

$path_info_da $path_info_mo $path_info_yr

diff --git a/t/t-templates/data/story.html b/t/t-templates/data/story.html new file mode 100644 index 0000000..7f3d068 --- /dev/null +++ b/t/t-templates/data/story.html @@ -0,0 +1,3 @@ +

$title

+
$body
+

posted at: $ti | path: $path | permanent link to this entry

diff --git a/t/t-templates/expected.html b/t/t-templates/expected.html new file mode 100644 index 0000000..3ebf4fe --- /dev/null +++ b/t/t-templates/expected.html @@ -0,0 +1,34 @@ +Content-Type: text/xhtml; charset=UTF-8 + + + + + + My Weblog + + + +

My Weblog

+

+

2006-07-19

+

Lorem ipsum

+
Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor.
+

posted at: 22:54 | path: | permanent link to this entry

+ + + diff --git a/t/t-templates/expected.rss b/t/t-templates/expected.rss new file mode 100644 index 0000000..a03fc8a --- /dev/null +++ b/t/t-templates/expected.rss @@ -0,0 +1,34 @@ +Content-Type: text/xml; charset=ISO-8859-1 + + + + + + + + My Weblog + http://localhost/./blosxom.cgi + Yet another Blosxom weblog. + en + + + Lorem ipsum + http://localhost/./blosxom.cgi/2006/07/19#1 + Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet ipso +facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor sit +amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +facto.Lorem ipsum dolor sit amet ipso facto.Lorem ipsum dolor sit amet +ipso facto.Lorem ipsum dolor sit amet ipso facto. Lorem ipsum dolor +sit amet ipso facto.Lorem ipsum dolor sit amet ipso facto. + +Lorem ipso hoccer foer tyr wuz de ras cora dola tymon ipso hoc cer fuz +de ramas cora dola tymon ipso hoccer. Lorem ipso foer tyr wuz de ramas +cora dola tym ipso hor.Lorem ipso foer tyr wuz de ramas cora dola tym +ipso hor tyr wuz de ramas cora dola tymon ipso foer tyr wuz de ramas +cora dola tymo. Lorem ipso hoccer foer tyr wuz de ras cora dola tymon +ipso hoc cer fuz de ramas cora dola tymon ipso hoccer. Lorem ipso foer +tyr wuz de ramas cora dola tym ipso hor. + + + diff --git a/t/t-templates/spec.yaml b/t/t-templates/spec.yaml new file mode 100644 index 0000000..93883d3 --- /dev/null +++ b/t/t-templates/spec.yaml @@ -0,0 +1,4 @@ +tests: + - + - "" + - expected.html -- 2.30.2