<commit_before>#!/usr/bin/env perl

=head1 Tests for the globus IO authorization modes

=cut

use strict;
use POSIX;
use Test;
use Cwd;

my @tests;
my @todo;

my $test_prog = './globus_io_authorization_test';

my $diff = 'diff';

sub basic_func
{
   my ($errors,$rc) = ("",0);
   my $args = shift;
   my $result;
   my $expect_failure = shift;
   
   unlink('core');
   my $command = "$test_prog $args";
   #print "Running: $command\n";
   chomp($result = `$test_prog $args`);

   if($rc != 0 && !$expect_failure)
   {
      $errors .= "Test exited with $rc. ";
   }

   if(-r 'core')
   {
      ok("Core file generated.", 'ok');
   }
   else
   {
       if(!$expect_failure)
       {
           ok($result, 'ok');
       }
       else
       {
           ok($result, "\nan authorization operation failed");
       }
   }
}

$ENV{X509_CERT_DIR} = cwd();
$ENV{X509_USER_PROXY} = "testcred.pem";

my $identity = `grid-proxy-info -identity`;
chomp($identity);

push(@tests, "basic_func('self',0);");
push(@tests, "basic_func('identity \"$identity\"',0)");
push(@tests, "basic_func('identity \"/CN=bad DN\"',1)");
push(@tests, "basic_func('callback',0);");
push(@tests, "basic_func('-callback',1);");

# Now that the tests are defined, set up the Test to deal with them.
plan tests => scalar(@tests), todo => \@todo;

# And run them all.
foreach (@tests)
{
   eval "&$_";
}
<commit_msg>Newline in wrong place was causing test failure.  Moved \n from front of line to back of line.<commit_after>#!/usr/bin/env perl

=head1 Tests for the globus IO authorization modes

=cut

use strict;
use POSIX;
use Test;
use Cwd;

my @tests;
my @todo;

my $test_prog = './globus_io_authorization_test';

my $diff = 'diff';

sub basic_func
{
   my ($errors,$rc) = ("",0);
   my $args = shift;
   my $result;
   my $expect_failure = shift;
   
   unlink('core');
   my $command = "$test_prog $args";
   #print "Running: $command\n";
   chomp($result = `$test_prog $args`);

   if($rc != 0 && !$expect_failure)
   {
      $errors .= "Test exited with $rc. ";
   }

   if(-r 'core')
   {
      ok("Core file generated.", 'ok');
   }
   else
   {
       if(!$expect_failure)
       {
           ok($result, 'ok');
       }
       else
       {
           ok($result, "an authorization operation failed\n");
       }
   }
}

$ENV{X509_CERT_DIR} = cwd();
$ENV{X509_USER_PROXY} = "testcred.pem";

my $identity = `grid-proxy-info -identity`;
chomp($identity);

push(@tests, "basic_func('self',0);");
push(@tests, "basic_func('identity \"$identity\"',0)");
push(@tests, "basic_func('identity \"/CN=bad DN\"',1)");
push(@tests, "basic_func('callback',0);");
push(@tests, "basic_func('-callback',1);");

# Now that the tests are defined, set up the Test to deal with them.
plan tests => scalar(@tests), todo => \@todo;

# And run them all.
foreach (@tests)
{
   eval "&$_";
}

{'fraction_non_alphanumeric': 0.18945518453427065, 'fraction_numerical': 0.00984182776801406, 'mean_word_length': 3.1730205278592374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2874891', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1042, 'n_words': 267}