From e2a868a8437ea9ef2cf88a5b934b28da2b8f425d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 28 May 2010 11:01:05 +0200 Subject: Fix comirror-setup unicode handling & add test for it --- test/60-comirror-setup.t | 58 +++++++++++++++++++++++++--------------------- test/next-unicroak/1.jpg | 0 test/next-unicroak/1.xhtml | 14 +++++++++++ test/next-unicroak/2.jpg | 0 test/next-unicroak/2.xhtml | 14 +++++++++++ test/next-unicroak/3.jpg | 0 test/next-unicroak/3.xhtml | 14 +++++++++++ test/next-unicroak/4.jpg | 0 test/next-unicroak/4.xhtml | 14 +++++++++++ test/next-unicroak/5.jpg | 0 test/next-unicroak/5.xhtml | 13 +++++++++++ 11 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 test/next-unicroak/1.jpg create mode 100644 test/next-unicroak/1.xhtml create mode 100644 test/next-unicroak/2.jpg create mode 100644 test/next-unicroak/2.xhtml create mode 100644 test/next-unicroak/3.jpg create mode 100644 test/next-unicroak/3.xhtml create mode 100644 test/next-unicroak/4.jpg create mode 100644 test/next-unicroak/4.xhtml create mode 100644 test/next-unicroak/5.jpg create mode 100644 test/next-unicroak/5.xhtml (limited to 'test') diff --git a/test/60-comirror-setup.t b/test/60-comirror-setup.t index 469b290..a3ac27c 100755 --- a/test/60-comirror-setup.t +++ b/test/60-comirror-setup.t @@ -3,15 +3,10 @@ use strict; use warnings; use 5.010; use Cwd; -use Test::More tests => 9; +use Test::More tests => 18; use Test::Cmd; -my $test = Test::Cmd->new( prog => 'bin/comirror-setup', workdir => q{} ); -my $cwd = $test->workdir(); - -my $next_base = 'file://' . getcwd() . '/test/next-loop'; -my ($str, $exit); -my @links; +my $test; sub check_key { my ($filetype, $key, $value) = @_; @@ -26,31 +21,42 @@ sub check_key { } } -ok($test, 'Create Test::Cmd object'); +for my $test_type (qw/loop unicroak/) { -$exit = $test->run( - chdir => $cwd -); + $test = Test::Cmd->new( prog => 'bin/comirror-setup', workdir => q{} ); + my $cwd = $test->workdir(); -ok($exit != 0, 'Not enough arguments: non-zero return'); + my $next_base = 'file://' . getcwd() . "/test/next-${test_type}"; + my ($str, $exit); + my @links; -is ($test->stdout, q{}, 'Not enough arguments: Nothing to stdout'); -isnt($test->stderr, q{}, 'Not enough arguments: Something to stderr'); + ok($test, 'Create Test::Cmd object'); -for my $i (1 .. 5) { - push(@links, "${next_base}/${i}.xhtml"); -} + $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'); -$exit = $test->run( - chdir => $cwd, - args => '--batch ' . join(q{ }, @links[0, 1, 3]), -); + 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'); + 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'); + 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('state', 'uri', $links[0]); -check_key('conf', 'image_re', "${next_base}/.+"); + check_key('conf', 'image_re', "${next_base}/.+"); + +} diff --git a/test/next-unicroak/1.jpg b/test/next-unicroak/1.jpg new file mode 100644 index 0000000..e69de29 diff --git a/test/next-unicroak/1.xhtml b/test/next-unicroak/1.xhtml new file mode 100644 index 0000000..9753197 --- /dev/null +++ b/test/next-unicroak/1.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/test/next-unicroak/2.jpg b/test/next-unicroak/2.jpg new file mode 100644 index 0000000..e69de29 diff --git a/test/next-unicroak/2.xhtml b/test/next-unicroak/2.xhtml new file mode 100644 index 0000000..b3c3969 --- /dev/null +++ b/test/next-unicroak/2.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/test/next-unicroak/3.jpg b/test/next-unicroak/3.jpg new file mode 100644 index 0000000..e69de29 diff --git a/test/next-unicroak/3.xhtml b/test/next-unicroak/3.xhtml new file mode 100644 index 0000000..b0488cf --- /dev/null +++ b/test/next-unicroak/3.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/test/next-unicroak/4.jpg b/test/next-unicroak/4.jpg new file mode 100644 index 0000000..e69de29 diff --git a/test/next-unicroak/4.xhtml b/test/next-unicroak/4.xhtml new file mode 100644 index 0000000..844854e --- /dev/null +++ b/test/next-unicroak/4.xhtml @@ -0,0 +1,14 @@ + + + + + + + +
+ + Next → +
+ + diff --git a/test/next-unicroak/5.jpg b/test/next-unicroak/5.jpg new file mode 100644 index 0000000..e69de29 diff --git a/test/next-unicroak/5.xhtml b/test/next-unicroak/5.xhtml new file mode 100644 index 0000000..41012d9 --- /dev/null +++ b/test/next-unicroak/5.xhtml @@ -0,0 +1,13 @@ + + + + + + + +
+ +
+ + -- cgit v1.2.3