From 1932c998cac488d6ba27789fea56bcf3a554a35c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 4 Mar 2011 12:22:22 +0100 Subject: Switch from Makefile to Build.PL --- t/00-compile.t | 8 +++++++ t/10-pod-coverage.t | 8 +++++++ t/50-comirror.t | 59 ++++++++++++++++++++++++++++++++++++++++++++++ t/60-comirror-setup.t | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ t/next-loop/1.jpg | 0 t/next-loop/1.xhtml | 14 +++++++++++ t/next-loop/2.jpg | 0 t/next-loop/2.xhtml | 14 +++++++++++ t/next-loop/3.jpg | 0 t/next-loop/3.xhtml | 14 +++++++++++ t/next-loop/4.jpg | 0 t/next-loop/4.xhtml | 14 +++++++++++ t/next-loop/5.jpg | 0 t/next-loop/5.xhtml | 14 +++++++++++ t/next-none/1.jpg | 0 t/next-none/1.xhtml | 14 +++++++++++ t/next-none/2.jpg | 0 t/next-none/2.xhtml | 14 +++++++++++ t/next-none/3.jpg | 0 t/next-none/3.xhtml | 14 +++++++++++ t/next-none/4.jpg | 0 t/next-none/4.xhtml | 14 +++++++++++ t/next-none/5.jpg | 0 t/next-none/5.xhtml | 13 +++++++++++ t/next-unicroak/1.jpg | 0 t/next-unicroak/1.xhtml | 14 +++++++++++ t/next-unicroak/2.jpg | 0 t/next-unicroak/2.xhtml | 14 +++++++++++ t/next-unicroak/3.jpg | 0 t/next-unicroak/3.xhtml | 14 +++++++++++ t/next-unicroak/4.jpg | 0 t/next-unicroak/4.xhtml | 14 +++++++++++ t/next-unicroak/5.jpg | 0 t/next-unicroak/5.xhtml | 13 +++++++++++ 34 files changed, 345 insertions(+) create mode 100755 t/00-compile.t create mode 100755 t/10-pod-coverage.t create mode 100755 t/50-comirror.t create mode 100755 t/60-comirror-setup.t create mode 100644 t/next-loop/1.jpg create mode 100644 t/next-loop/1.xhtml create mode 100644 t/next-loop/2.jpg create mode 100644 t/next-loop/2.xhtml create mode 100644 t/next-loop/3.jpg create mode 100644 t/next-loop/3.xhtml create mode 100644 t/next-loop/4.jpg create mode 100644 t/next-loop/4.xhtml create mode 100644 t/next-loop/5.jpg create mode 100644 t/next-loop/5.xhtml create mode 100644 t/next-none/1.jpg create mode 100644 t/next-none/1.xhtml create mode 100644 t/next-none/2.jpg create mode 100644 t/next-none/2.xhtml create mode 100644 t/next-none/3.jpg create mode 100644 t/next-none/3.xhtml create mode 100644 t/next-none/4.jpg create mode 100644 t/next-none/4.xhtml create mode 100644 t/next-none/5.jpg create mode 100644 t/next-none/5.xhtml create mode 100644 t/next-unicroak/1.jpg create mode 100644 t/next-unicroak/1.xhtml create mode 100644 t/next-unicroak/2.jpg create mode 100644 t/next-unicroak/2.xhtml create mode 100644 t/next-unicroak/3.jpg create mode 100644 t/next-unicroak/3.xhtml create mode 100644 t/next-unicroak/4.jpg create mode 100644 t/next-unicroak/4.xhtml create mode 100644 t/next-unicroak/5.jpg create mode 100644 t/next-unicroak/5.xhtml (limited to 't') diff --git a/t/00-compile.t b/t/00-compile.t new file mode 100755 index 0000000..d7b89cb --- /dev/null +++ b/t/00-compile.t @@ -0,0 +1,8 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Test::More; +use Test::Compile; + +all_pl_files_ok(qw{ bin/comirror bin/comirror-setup }); diff --git a/t/10-pod-coverage.t b/t/10-pod-coverage.t new file mode 100755 index 0000000..df81177 --- /dev/null +++ b/t/10-pod-coverage.t @@ -0,0 +1,8 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Test::More; +use Test::Pod; + +all_pod_files_ok(qw{ bin/comirror bin/comirror-setup }); diff --git a/t/50-comirror.t b/t/50-comirror.t new file mode 100755 index 0000000..6adc23c --- /dev/null +++ b/t/50-comirror.t @@ -0,0 +1,59 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Cwd; +use Test::More tests => 26; +use Test::Cmd; + +sub check_key { + my ($test, $filetype, $key, $value) = @_; + my @lines; + $test->read(\@lines, "comirror.${filetype}"); + + if(grep { $_ eq "$key\t$value\n" } @lines) { + pass("${filetype}: ${key} = ${value}"); + } + else { + fail("${filetype}: ${key} = ${value}"); + } +} + +for my $next_type (qw/ loop none /) { + + my $test = Test::Cmd->new( prog => 'bin/comirror', workdir => q{} ); + my $cwd = $test->workdir(); + + my $next_base = 'file://' . getcwd() . "/t/next-${next_type}"; + my ($str, $exit); + + ok($test, "Create Test::Cmd object ($next_type)"); + + $test->write('comirror.conf', "image_re\t${next_base}/.+\n"); + + $exit = $test->run( + chdir => $cwd, + args => "${next_base}/1.xhtml", + ); + + ok($exit == 0, 'First run: return 0'); + + isnt($test->stdout, q{}, 'First run: Non-empty stdout'); + is ($test->stderr, q{}, 'First run: Empty stderr'); + + check_key($test, 'state', 'uri', "${next_base}/4.xhtml"); + + for my $i (1 .. 5) { + ok(-e "$cwd/$i.jpg", + "$i.jpg was downloaded successfully ($next_type)"); + } + + $exit = $test->run( + chdir => $cwd, + ); + + ok(($exit >> 8) == 1, 'Second run: return 1 (no new images loaded)'); + + isnt($test->stdout, q{}, 'Second run: Non-empty stdout'); + is ($test->stderr, q{}, 'Second run: Empty stderr'); +} diff --git a/t/60-comirror-setup.t b/t/60-comirror-setup.t new file mode 100755 index 0000000..a487185 --- /dev/null +++ b/t/60-comirror-setup.t @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Cwd; +use Test::More tests => 18; +use Test::Cmd; + +my $test; + +sub check_key { + my ($filetype, $key, $value) = @_; + my @lines; + $test->read(\@lines, "comirror.${filetype}"); + + if(grep { $_ eq "$key\t$value\n" } @lines) { + pass("${filetype}: ${key} = ${value}"); + } + else { + fail("${filetype}: ${key} = ${value}"); + } +} + +for my $test_type (qw/loop unicroak/) { + + $test = Test::Cmd->new( prog => 'bin/comirror-setup', workdir => q{} ); + my $cwd = $test->workdir(); + + my $next_base = 'file://' . getcwd() . "/t/next-${test_type}"; + my ($str, $exit); + my @links; + + ok($test, 'Create Test::Cmd object'); + + $exit = $test->run( + chdir => $cwd + ); + + ok($exit != 0, 'Not enough arguments: non-zero return'); + + is ($test->stdout, q{}, 'Not enough arguments: Nothing to stdout'); + isnt($test->stderr, q{}, 'Not enough arguments: Something to stderr'); + + for my $i (1 .. 5) { + push(@links, "${next_base}/${i}.xhtml"); + } + + $exit = $test->run( + chdir => $cwd, + args => '--batch ' . join(q{ }, @links[0, 1, 3]), + ); + + ok($exit == 0, 'Correct usage: return zero'); + + isnt($test->stdout, q{}, 'Correct usage: Something to stdout'); + is ($test->stderr, q{}, 'Correct usage: Nothing to stderr'); + + check_key('state', 'uri', $links[0]); + + check_key('conf', 'image_re', "${next_base}/.+"); + +} diff --git a/t/next-loop/1.jpg b/t/next-loop/1.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-loop/1.xhtml b/t/next-loop/1.xhtml new file mode 100644 index 0000000..c0efc65 --- /dev/null +++ b/t/next-loop/1.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-loop/2.jpg b/t/next-loop/2.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-loop/2.xhtml b/t/next-loop/2.xhtml new file mode 100644 index 0000000..60e57e1 --- /dev/null +++ b/t/next-loop/2.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-loop/3.jpg b/t/next-loop/3.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-loop/3.xhtml b/t/next-loop/3.xhtml new file mode 100644 index 0000000..97eadf4 --- /dev/null +++ b/t/next-loop/3.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-loop/4.jpg b/t/next-loop/4.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-loop/4.xhtml b/t/next-loop/4.xhtml new file mode 100644 index 0000000..b0cf520 --- /dev/null +++ b/t/next-loop/4.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-loop/5.jpg b/t/next-loop/5.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-loop/5.xhtml b/t/next-loop/5.xhtml new file mode 100644 index 0000000..86ff9e8 --- /dev/null +++ b/t/next-loop/5.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-none/1.jpg b/t/next-none/1.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-none/1.xhtml b/t/next-none/1.xhtml new file mode 100644 index 0000000..c0efc65 --- /dev/null +++ b/t/next-none/1.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-none/2.jpg b/t/next-none/2.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-none/2.xhtml b/t/next-none/2.xhtml new file mode 100644 index 0000000..60e57e1 --- /dev/null +++ b/t/next-none/2.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-none/3.jpg b/t/next-none/3.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-none/3.xhtml b/t/next-none/3.xhtml new file mode 100644 index 0000000..97eadf4 --- /dev/null +++ b/t/next-none/3.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-none/4.jpg b/t/next-none/4.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-none/4.xhtml b/t/next-none/4.xhtml new file mode 100644 index 0000000..b0cf520 --- /dev/null +++ b/t/next-none/4.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next => +
+ + diff --git a/t/next-none/5.jpg b/t/next-none/5.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-none/5.xhtml b/t/next-none/5.xhtml new file mode 100644 index 0000000..41012d9 --- /dev/null +++ b/t/next-none/5.xhtml @@ -0,0 +1,13 @@ + + + + + + + +
+ +
+ + diff --git a/t/next-unicroak/1.jpg b/t/next-unicroak/1.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-unicroak/1.xhtml b/t/next-unicroak/1.xhtml new file mode 100644 index 0000000..9753197 --- /dev/null +++ b/t/next-unicroak/1.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/t/next-unicroak/2.jpg b/t/next-unicroak/2.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-unicroak/2.xhtml b/t/next-unicroak/2.xhtml new file mode 100644 index 0000000..b3c3969 --- /dev/null +++ b/t/next-unicroak/2.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/t/next-unicroak/3.jpg b/t/next-unicroak/3.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-unicroak/3.xhtml b/t/next-unicroak/3.xhtml new file mode 100644 index 0000000..b0488cf --- /dev/null +++ b/t/next-unicroak/3.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/t/next-unicroak/4.jpg b/t/next-unicroak/4.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-unicroak/4.xhtml b/t/next-unicroak/4.xhtml new file mode 100644 index 0000000..844854e --- /dev/null +++ b/t/next-unicroak/4.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/t/next-unicroak/5.jpg b/t/next-unicroak/5.jpg new file mode 100644 index 0000000..e69de29 diff --git a/t/next-unicroak/5.xhtml b/t/next-unicroak/5.xhtml new file mode 100644 index 0000000..41012d9 --- /dev/null +++ b/t/next-unicroak/5.xhtml @@ -0,0 +1,13 @@ + + + + + + + +
+ +
+ + -- cgit v1.2.3