<commit_before>#!/usr/bin/perl
use strict;
use warnings;
use Test::More 0.88;
use Test::DZil;
use Path::Tiny;

# test the file content generated when various attributes are set

my $fname  = 'Richard';
my $lname  = 'Simões';
my $author = join ' ', $fname, $lname;
sub get_content {
  my ($args) = @_;

  my $name = 'Test::PodSpelling';
  my $zilla = Builder->from_config(
    { dist_root => 'corpus/foo' },
    {
      add_files => {
        'source/lib/Spell/Checked.pm' => "package Spell::Checked;\n1;\n",
        'source/dist.ini' => dist_ini(
          {
            name             => 'Spell-Checked',
            version          => 1,
            abstract         => 'spelled wrong',
            license          => 'Perl_5',
            author           => $author,
            copyright_holder => $author,
          },
          [GatherDir =>],
          [$name => $args],
        )
      }
    }
  );

  $zilla->build;
  my $build_dir = $zilla->tempdir->subdir('build');
  my $file = path($build_dir, 'xt', 'author', 'pod-spell.t');
  return $file->slurp_utf8;
}

my $content = get_content({});
  like $content, qr/Pod::Wordlist/, q[use default wordlist];
unlike $content, qr/set_spell_cmd/, q[by default don't set spell command];
  like $content, qr/add_stopwords/,               q[by default we add stopwords];
  like $content, qr/__DATA__\s$fname\n$lname/,    q[DATA handle includes author];

$content = get_content({wordlist => 'Foo::Bar'});
unlike $content, qr/Pod::Wordlist/, q[custom word list];
  like $content, qr/Foo::Bar/,      q[custom word list];
<commit_msg>formatting<commit_after>#!/usr/bin/perl
use strict;
use warnings;
use Test::More 0.88;
use Test::DZil;
use Path::Tiny;

# test the file content generated when various attributes are set

my $fname  = 'Richard';
my $lname  = 'Simões';
my $author = join ' ', $fname, $lname;
sub get_content {
  my ($args) = @_;

  my $name = 'Test::PodSpelling';
  my $zilla = Builder->from_config(
    { dist_root => 'corpus/foo' },
    {
      add_files => {
        'source/lib/Spell/Checked.pm' => "package Spell::Checked;\n1;\n",
        'source/dist.ini' => dist_ini(
          {
            name             => 'Spell-Checked',
            version          => 1,
            abstract         => 'spelled wrong',
            license          => 'Perl_5',
            author           => $author,
            copyright_holder => $author,
          },
          [GatherDir =>],
          [$name => $args],
        )
      }
    }
  );

  $zilla->build;
  my $build_dir = $zilla->tempdir->subdir('build');
  my $file = path($build_dir, 'xt', 'author', 'pod-spell.t');
  return $file->slurp_utf8;
}

my $content = get_content({});
  like $content, qr/Pod::Wordlist/,            q[use default wordlist];
unlike $content, qr/set_spell_cmd/,            q[by default don't set spell command];
  like $content, qr/add_stopwords/,            q[by default we add stopwords];
  like $content, qr/__DATA__\s$fname\n$lname/, q[DATA handle includes author];

$content = get_content({wordlist => 'Foo::Bar'});
unlike $content, qr/Pod::Wordlist/, q[custom word list];
  like $content, qr/Foo::Bar/,      q[custom word list];

{'fraction_non_alphanumeric': 0.16294432211387228, 'fraction_numerical': 0.004403900597672224, 'mean_word_length': 2.3722163308589606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, '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': '3572108', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1066, 'n_words': 254}