<commit_before>#!/usr/bin/perl -w

use strict;
use Test::More qw(no_plan);

use FindBin qw($Bin);
use File::Find;

my @modules;
my %uses;

finddepth(
	sub {
		m{^\w.*\.pm$} && do {
			my $module = $File::Find::name;
			$module =~ s{.*/lib.}{};
			$module =~ s{[/\\]}{::}g;
			$module =~ s{.pm$}{};
			push @modules, $module;
			open MODULE, "<", $_ or die "Failed to open ($_): $!";
			while (<MODULE>) {
				if (m{^use (\S+);}) {
					$uses{$module}{$1}++;
				}
				if (m{^(?:extends|with) (["'])?(\S+)\1}) {
					$uses{$module}{$2}++;
				}
			}
			close MODULE;
		};
	},
	"$Bin/../lib"
);

while ( my ($module, $uses) = each %uses ) {
	my @gonners;
	while ( my $dep = each %$uses ) {
		if ( not exists $uses{$dep} ) {
			push @gonners, $dep;
		}
	}
	delete $uses->{$_} for @gonners;
}

my %done;
while (@modules) {
	my (@winners) = grep { !$uses{$_} or !keys %{ $uses{$_} } } @modules;
	if ( !@winners ) {
		@winners = shift @modules;
	}
	for my $module ( sort @winners ) {
		my @fail;
		local ( $SIG{__WARN__} ) = sub {
			push @fail, join " ", @_;
			warn "# oh look a warning: @_";
		};
		use_ok($module);
		is( @fail, 0, "no warnings issued" );<commit_msg>Ignore Moose warnings about sugar in load test<commit_after>#!/usr/bin/perl -w

use strict;
use Test::More qw(no_plan);

use FindBin qw($Bin);
use File::Find;

my @modules;
my %uses;

finddepth(
	sub {
		m{^\w.*\.pm$} && do {
			my $module = $File::Find::name;
			$module =~ s{.*/lib.}{};
			$module =~ s{[/\\]}{::}g;
			$module =~ s{.pm$}{};
			push @modules, $module;
			open MODULE, "<", $_ or die "Failed to open ($_): $!";
			while (<MODULE>) {
				if (m{^use (\S+);}) {
					$uses{$module}{$1}++;
				}
				if (m{^(?:extends|with) (["'])?(\S+)\1}) {
					$uses{$module}{$2}++;
				}
			}
			close MODULE;
		};
	},
	"$Bin/../lib"
);

while ( my ($module, $uses) = each %uses ) {
	my @gonners;
	while ( my $dep = each %$uses ) {
		if ( not exists $uses{$dep} ) {
			push @gonners, $dep;
		}
	}
	delete $uses->{$_} for @gonners;
}

my %done;
while (@modules) {
	my (@winners) = grep { !$uses{$_} or !keys %{ $uses{$_} } } @modules;
	if ( !@winners ) {
		@winners = shift @modules;
	}
	for my $module ( sort @winners ) {
		my @fail;
		local ( $SIG{__WARN__} ) = sub {
			return if ( $_[0] =~ /does not export its sugar/);
			push @fail, join " ", @_;
			warn "# oh look a warning: @_";
		};
		use_ok($module);
		is( @fail, 0, "no warnings issued" );
{'fraction_non_alphanumeric': 0.25175983436853, 'fraction_numerical': 0.0037267080745341614, 'mean_word_length': 2.903069466882068, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4755320', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1021, 'n_words': 251}