[libcode-tidyall-perl] 92/374: add SVN test

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:25:55 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libcode-tidyall-perl.

commit 2deb621359fac75b42b1dd444c70cd883bd13652
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Mon Jul 16 15:37:52 2012 -0700

    add SVN test
---
 lib/Code/TidyAll/t/SVN.pm |   49 +++++++++++++++++++++++++++++++++++++++++++++
 t/SVN.t                   |    3 +++
 2 files changed, 52 insertions(+)

diff --git a/lib/Code/TidyAll/t/SVN.pm b/lib/Code/TidyAll/t/SVN.pm
new file mode 100644
index 0000000..fbe6b99
--- /dev/null
+++ b/lib/Code/TidyAll/t/SVN.pm
@@ -0,0 +1,49 @@
+package Code::TidyAll::t::SVN;
+use Code::TidyAll::Util qw(dirname mkpath read_file realpath tempdir_simple write_file);
+use Code::TidyAll;
+use Capture::Tiny qw(capture_stdout);
+use IPC::System::Simple qw(run);
+use Test::Class::Most parent => 'Code::TidyAll::Test::Class';
+
+my $precommit_hook_template;
+
+sub test_svn_precommit_hook : Tests {
+    my ($self) = @_;
+
+    my $temp_dir = tempdir_simple;
+    my $repo_dir = "$temp_dir/repo";
+    my $src_dir  = "$temp_dir/src";
+    my $work_dir = "$temp_dir/work";
+
+    run("svnadmin create $repo_dir");
+    my $hooks_dir = "$repo_dir/hooks";
+    ok( -d $hooks_dir, "$hooks_dir exists" );
+
+    mkpath( $src_dir, 0, 0775 );
+    write_file( "$src_dir/foo.txt", "abc" );
+
+    run( sprintf( 'svn import %s file://%s/myapp/trunk -m "import"', $src_dir,  $repo_dir ) );
+    run( sprintf( 'svn checkout -q file://%s/myapp/trunk %s',        $repo_dir, $work_dir ) );
+
+    is( read_file("$work_dir/foo.txt"), "abc", "checkout and import ok" );
+
+    my $precommit_hook_file = "$hooks_dir/pre-commit";
+    my $precommit_hook = sprintf( $precommit_hook_template, realpath("lib") );
+    write_file( $precommit_hook_file, $precommit_hook );
+
+}
+
+$precommit_hook_template = '#!/usr/bin/perl
+use lib qw(%s);
+use Code::TidyAll::SVN::Precommit;
+use Log::Any::Adapter;
+use strict;
+use warnings;
+
+Log::Any::Adapter->set( "Dispatch",
+    outputs => [ [ "Screen", min_level => "debug", newline => 1 ] ] );
+Code::TidyAll::SVN::Precommit->check(
+    extra_conf_files => ["perlcriticrc"],
+    tidyall_options => { verbose => 1 }
+);
+';
diff --git a/t/SVN.t b/t/SVN.t
new file mode 100644
index 0000000..e0e826e
--- /dev/null
+++ b/t/SVN.t
@@ -0,0 +1,3 @@
+#!/usr/bin/perl
+use Code::TidyAll::t::SVN;
+Code::TidyAll::t::SVN->runtests;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git



More information about the Pkg-perl-cvs-commits mailing list