]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
updates to the testing scripts
authorAilin Nemui <redacted>
Sun, 25 Jan 2026 11:58:34 +0000 (12:58 +0100)
committerAilin Nemui <redacted>
Sun, 25 Jan 2026 13:36:36 +0000 (14:36 +0100)
- 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

_testing/_irssi_test.pl
_testing/_irssi_test_py.pl
_testing/run-test.zsh

index 670c839404d66f848c945dcb850067aa9c509bc5..0b576b68d04e3148a9e6802885c15010114fbe47 100644 (file)
@@ -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) {
index 457ece1d3094f1916f2d1a0f01b1558731597aef..03f3fb773aa963962edd3bc7f87917c8ca3d90dc 100644 (file)
@@ -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");
index f33259d4e7f49b3103d3b43e9070576a8df1d285..69b6c38213746a89b52cb4c303d8f7d1d6fa8ccd 100755 (executable)
@@ -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
git clone https://git.99rst.org/PROJECT