Advanced-Config

 view release on metacpan or  search on metacpan

t/75-check_all_languages.t  view on Meta::CPAN

#!/usr/bin/perl

use strict;
use warnings;

use Test::More;
use File::Basename;
use File::Spec;
use File::Glob qw (bsd_glob);
use Fred::Fish::DBUG 2.09 qw ( on );
use Fred::Fish::DBUG::Test 2.09;

# How to find the helper module ...
BEGIN { push (@INC, File::Spec->catdir (".", "t", "test-helper")); }
use helper1234;

# ---------------------------------------------------------------------
# Automatically creates a config file with all Date::Languages in use.
# It doesn't use the tools Advanced::Config has to give me more
# direct control on how the config file is created.  Also when originally
# created those tools hadn't been created yet.
# ---------------------------------------------------------------------
# After the config file has been created it attempts to use the
# Config object to validate everything works.
# ---------------------------------------------------------------------

my $fish;
my $config_file_normal;
my $config_file_wide;
my @global_languages;
my @global_lang_use_utf8;
my $run_as_developer = 0;

BEGIN {
   # The config file this program is to create!
   $config_file_normal = File::Spec->catfile (dirname ($0), "config", "75-all_languages_normal.cfg");
   $config_file_wide   = File::Spec->catfile (dirname ($0), "config", "75-all_languages_wide.cfg");
   unlink ( $config_file_normal, $config_file_wide );

   $fish = turn_fish_on_off_for_advanced_config ();

   unlink ( $fish );

   DBUG_ENTER_FUNC ();

   use_ok ("Advanced::Config");

   DBUG_VOID_RETURN ();

   # Turn fish on ...
   DBUG_PUSH ( $fish, allow_utf8 => 1 );

   $run_as_developer = $ENV{FULL_75_TEST} ? 1 : 0;
}

# Just proving it's a red herring.
sub uses_utf8_module
{
   my $file  = shift;

   my $found = 0;
   unless ( open (FH, "<", $file) ) {
      dbug_ok (0, "Can't open the language file for reading: " . $file);
      done_testing ();
      DBUG_LEAVE (0);
   }

   while (<FH>) {
      if ( $_ =~ m/^\s*use\s+utf8\s*;/ ) {
         $found = 1;
         last;
      }
   }

   close (FH);

   return ($found);
}

BEGIN



( run in 0.957 second using v1.01-cache-2.11-cpan-39bf76dae61 )