You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/05/08 02:51:33 UTC

svn commit: rev 10564 - incubator/spamassassin/trunk/t

Author: jm
Date: Fri May  7 17:51:32 2004
New Revision: 10564

Modified:
   incubator/spamassassin/trunk/t/spamd_utf8.t
Log:
bug 3327: spamd_utf8.t test fails if the locale is not installed

Modified: incubator/spamassassin/trunk/t/spamd_utf8.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_utf8.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_utf8.t	Fri May  7 17:51:32 2004
@@ -2,11 +2,23 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_utf8");
-use Test; BEGIN { plan tests => ($SKIP_SPAMD_TESTS ? 0 : 3) };
+my $am_running;
+my $testlocale = 'en_US.UTF-8';	# ensure we test in UTF-8 locale
 
-exit if $SKIP_SPAMD_TESTS;
+use Test; BEGIN {
+  my $havelocale = 1;
+  open (IN, "LANG=$testlocale perl -e 'exit 0' 2>&1 |");
+  while (<IN>) {
+    /Please check that your locale settings/ and ($havelocale = 0);
+  }
+  close IN;
+
+  $am_running = (!$SKIP_SPAMD_TESTS && $havelocale);
+  plan tests => ($am_running ? 3 : 0);
+};
 
-$ENV{'LANG'} = 'en_US.UTF-8';	# ensure we test in UTF-8 locale
+exit unless $am_running;
+$ENV{'LANG'} = $testlocale;
 
 # ---------------------------------------------------------------------------
 
@@ -20,4 +32,6 @@
 
 ok (sdrun ("-L", "< data/spam/008", \&patterns_run_cb));
 ok_all_patterns();
+exit;
 
+# ---------------------------------------------------------------------------