From: Ailin Nemui Date: Sun, 25 Jan 2026 11:58:34 +0000 (+0100) Subject: updates to the testing scripts X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=b47f2f6d249978d1eaf9d3ec54b9c06a918b5bff;p=irssi-scripts.irssi.org.git updates to the testing scripts - add an ignore for Irssi::Irc::Dcc - use the same `@commands` code for Perl and Python - deal correctly with the case of multiple irc.log files --- diff --git a/_testing/_irssi_test.pl b/_testing/_irssi_test.pl index 670c839..0b576b6 100644 --- a/_testing/_irssi_test.pl +++ b/_testing/_irssi_test.pl @@ -12,6 +12,10 @@ my $CURRENT_SCRIPT = $ENV{CURRENT_SCRIPT}; my $PWD = $ENV{PWD}; my $SWD = "$PWD/../.."; Irssi::command('^window log on'); +my %existing_commands; +%existing_commands = map { ("$_->{cmd}$;$_->{category}" => 1) } Irssi::commands; + + Irssi::command("script load $CURRENT_SCRIPT"); my (@packages) = grep { !/^_/ } keys %Irssi::Script::; @@ -51,7 +55,7 @@ require Perl::PrereqScanner; my $prereq_results = Perl::PrereqScanner->new->scan_file("$SWD/scripts/$CURRENT_SCRIPT.pl"); my @modules = grep { $_ ne 'perl' && - $_ ne 'Irssi' && $_ ne 'Irssi::UI' && $_ ne 'Irssi::TextUI' && $_ ne 'Irssi::Irc' + $_ ne 'Irssi' && $_ ne 'Irssi::UI' && $_ ne 'Irssi::TextUI' && $_ ne 'Irssi::Irc' && $_ ne 'Irssi::Irc::Dcc' && !Module::CoreList->first_release($_) } sort keys %{ $prereq_results->as_string_hash }; @@ -74,7 +78,7 @@ unless (defined $package) { else { %info = do { no strict 'refs'; %{"Irssi::Script::${package}IRSSI"} }; $version = do { no strict 'refs'; ${"Irssi::Script::${package}VERSION"} }; - @commands = sort map { $_->{cmd} } grep { $_->{category} eq "Perl scripts' commands" } Irssi::commands; + @commands = sort map { $_->{cmd} } grep { !$existing_commands{"$_->{cmd}$;$_->{category}"} } Irssi::commands; } delete $info{''}; for my $rb (keys %info) { diff --git a/_testing/_irssi_test_py.pl b/_testing/_irssi_test_py.pl index 457ece1..03f3fb7 100644 --- a/_testing/_irssi_test_py.pl +++ b/_testing/_irssi_test_py.pl @@ -33,10 +33,10 @@ Irssi::command_bind('_irssi_test_py_cb' => sub { eval { %info = %{$doc->{'IRSSI'}} }; eval { $version = $doc->{'VERSION'} }; eval { $package = $doc->{'package'} }; - @commands = sort grep { !$existing_commands{$_} } map { $_->{cmd} } Irssi::commands; + @commands = sort map { $_->{cmd} } grep { !$existing_commands{"$_->{cmd}$;$_->{category}"} } Irssi::commands; }); -%existing_commands = map { ($_->{cmd} => 1) } Irssi::commands; +%existing_commands = map { ("$_->{cmd}$;$_->{category}" => 1) } Irssi::commands; Irssi::command('^window log on'); Irssi::command("py load $CURRENT_SCRIPT"); diff --git a/_testing/run-test.zsh b/_testing/run-test.zsh index f33259d..69b6c38 100755 --- a/_testing/run-test.zsh +++ b/_testing/run-test.zsh @@ -47,7 +47,8 @@ s,\Q$ENV{PWD}/Test/.home/scripts/\E,,g; s,\Q$ENV{PWD}/Test/.home\E,..,g; s,\Q$ENV{PWD}\E,...,g; s,\(\@INC contains: .*?\),,g' $logs - mv $logs "Test/${scriptfile:t:r}/irssi.log" + cat $logs > "Test/${scriptfile:t:r}/irssi.log" + rm -- $logs } \ elif [[ -f stderr.log ]] { cat stderr.log