From 4e7b7a178890eb8d28edcd2e6ab2763c9a3988e5 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Sun, 5 Feb 2012 03:29:14 -0500 Subject: [PATCH] Test checkconfig(). --- t/cvs.t | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/t/cvs.t b/t/cvs.t index 5717782a2..9efe1caae 100755 --- a/t/cvs.t +++ b/t/cvs.t @@ -62,6 +62,7 @@ sub test_cvs_run_cvsps { # parameterize command like run_cvs() # expose config vars for e.g. "--cvs-direct -z 30" # always pass -x (unless proven otherwise) + # - but diff doesn't! optimization alert # always pass -b HEAD (configurable like gitmaster_branch?) } @@ -98,20 +99,38 @@ sub test_cvs_is_controlling { # TESTS FOR GENERAL PLUGIN API CALLS sub test_checkconfig { - # undef cvspath, expect "ikiwiki" - # define cvspath normally, get it back - # define cvspath in a subdir, get it back? - # define cvspath with extra slashes, get sanitized version back - # - yoink test_extra_path_slashes - # undef cvs_wrapper, expect $config{wrappers} same size as before - - my $initial_cvspath = $config{cvspath}; - $config{cvspath} = "/ikiwiki//"; + my $default_cvspath = 'ikiwiki'; + + undef $config{cvspath}; IkiWiki::checkconfig(); + is( + $config{cvspath}, $default_cvspath, + q{can provide default cvspath}, + ); + + $config{cvspath} = "/$default_cvspath/"; IkiWiki::checkconfig(); + is( + $config{cvspath}, $default_cvspath, + q{can set typical cvspath and strip well-meaning slashes}, + ); + + $config{cvspath} = "/$default_cvspath//subdir"; IkiWiki::checkconfig(); + is( + $config{cvspath}, "$default_cvspath/subdir", + q{can really sanitize cvspath as assumed by rcs_recentchanges}, + ); + + my $default_num_wrappers = @{$config{wrappers}}; + undef $config{cvs_wrapper}; IkiWiki::checkconfig(); + is( + @{$config{wrappers}}, $default_num_wrappers, + q{can start with no wrappers configured}, + ); + + $config{cvs_wrapper} = $config{cvsrepo} . "/CVSROOT/post-commit"; IkiWiki::checkconfig(); is( - $config{cvspath}, - $initial_cvspath, - q{rcs_recentchanges assumes checkconfig has sanitized cvspath}, + @{$config{wrappers}}, ++$default_num_wrappers, + q{can add cvs_wrapper}, ); } -- 2.45.0