perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r28782 - in branches/autoicu: config/auto t/steps

Subject: [svn:parrot] r28782 - in branches/autoicu: config/auto t/steps
From:
Date: Sat, 28 Jun 2008 08:00:30 -0700 PDT
Newsgroups: perl.cvs.parrot

Author: jkeenan
Date: Sat Jun 28 08:00:24 2008
New Revision: 28782

Modified:
   branches/autoicu/config/auto/icu.pm
   branches/autoicu/t/steps/auto_icu-01.t

Log:
[configure] Refactor some code inside runstep() into _handle_icuconfig_opt()
and test it.


Modified: branches/autoicu/config/auto/icu.pm
==============================================================================
--- branches/autoicu/config/auto/icu.pm (original)
+++ branches/autoicu/config/auto/icu.pm Sat Jun 28 08:00:24 2008
@@ -63,7 +63,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $icushared, $icuheaders, $icuconfig, $without_opt ) =
+    my ( $verbose, $icushared, $icuheaders, $icuconfig_opt, $without_opt ) =
         $conf->options->get( qw|
             verbose
             icushared
@@ -91,9 +91,7 @@
     # ruled out by being provided with the value 'none' -- an empty string 
     # is its most appropriate value.
 
-    if ( ( ! $icuconfig ) or ( $icuconfig eq q{none} ) ) {
-        $icuconfig = q{};
-    }
+    my $icuconfig = _handle_icuconfig_opt($icuconfig_opt);
 
     # $without_opt holds user's command-line value for --without-icu=?
     # If it's a true value, there's no point in going further.  We set the
@@ -284,6 +282,18 @@
     }
 }
 
+sub _handle_icuconfig_opt {
+    my $icuconfig_opt = shift;
+    my $icuconfig;
+    if ( ( ! $icuconfig_opt ) or ( $icuconfig_opt eq q{none} ) ) {
+        $icuconfig = q{};
+    }
+    else {
+        $icuconfig = $icuconfig_opt;
+    }
+    return $icuconfig;
+}
+
 sub die_message {
     my $die = <<"HELP";
 Something is wrong with your ICU installation!

Modified: branches/autoicu/t/steps/auto_icu-01.t
==============================================================================
--- branches/autoicu/t/steps/auto_icu-01.t      (original)
+++ branches/autoicu/t/steps/auto_icu-01.t      Sat Jun 28 08:00:24 2008
@@ -52,7 +52,17 @@
 is( $step->result(), 'no', "Got expected result" );
 
 # Test some internal routines
-my ($icuconfig, $autodetect, $without);
+my $icuconfig;
+my $phony = q{/path/to/icu-config};
+
+is (auto::icu::_handle_icuconfig_opt(undef), q{},
+    "Got expected value for icu-config");
+is (auto::icu::_handle_icuconfig_opt('none'), q{},
+    "Got expected value for icu-config");
+is (auto::icu::_handle_icuconfig_opt($phony), $phony,
+    "Got expected value for icu-config");
+
+my ($autodetect, $without);
 
 ($icuconfig, $autodetect, $without) =
     auto::icu::_handle_search_for_icu_config( {
@@ -112,8 +122,6 @@
         "Got expected verbose output");
 }
 
-my $phony = q{/path/to/icu-config};
-
 ($icuconfig, $autodetect, $without) =
     auto::icu::_handle_autodetect( {
         icuconfig   => $phony,

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r28782 - in branches/autoicu: config/auto t/steps, jkeenan <=