Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-11-28 05:51:03 UTC

Modified files:
  Tag: u2_10_12_branch
     tests/test-driver.pl tests/bug-1674539.cmd tests/bug-1640796.cmd

Added files:
  Tag: u2_10_12_branch
     tests/bug-1840011.cmd

Log message:

Update test scripts to run properly with newer POE; add test for SF#1840011.

---------------------- diff included ----------------------
Index: ircu2.10/tests/bug-1640796.cmd
diff -u ircu2.10/tests/bug-1640796.cmd:1.1.2.1 
ircu2.10/tests/bug-1640796.cmd:1.1.2.2
--- ircu2.10/tests/bug-1640796.cmd:1.1.2.1      Mon Jan 22 18:23:35 2007
+++ ircu2.10/tests/bug-1640796.cmd      Tue Nov 27 21:50:53 2007
@@ -26,10 +26,10 @@
 # servers.)
 :cl1 mode %channel% +D-D
 :cl1 mode %channel%
-:cl1 expect %srv1-name% 324 %cl1-nick% %channel% \\+.*d
+:cl1 expect %srv1-name% 324 %channel% \\+.*d
 
 # Make sure that client 1 does see the -d when client 2 quits
 :cl2 wait cl1
-:cl2 part %channel% leaving
 :cl1 expect %hidden-srv% mode %channel% -d
+:cl2 part %channel%
 :cl1 quit done
Index: ircu2.10/tests/bug-1674539.cmd
diff -u ircu2.10/tests/bug-1674539.cmd:1.1.2.1 
ircu2.10/tests/bug-1674539.cmd:1.1.2.2
--- ircu2.10/tests/bug-1674539.cmd:1.1.2.1      Mon Mar  5 18:35:24 2007
+++ ircu2.10/tests/bug-1674539.cmd      Tue Nov 27 21:50:53 2007
@@ -17,14 +17,14 @@
 # Check that we get local privileges properly.
 :cl1 wait cl2,cl3
 :cl1 raw :privs %cl1-nick%
-:cl1 expect %srv1-name% 270 %cl1-nick% %cl1-nick% :CHAN_LIMIT
+:cl1 expect %srv1-name% 270 %cl1-nick% :CHAN_LIMIT
 :cl1 raw :privs %cl2-nick%
-:cl1 expect %srv1-name% 270 %cl1-nick% %cl2-nick% :CHAN_LIMIT
+:cl1 expect %srv1-name% 270 %cl2-nick% :CHAN_LIMIT
 
 # Bug 1674539 is that remote /privs do not get any response.
 # Testing shows that the problem only shows up with a hub between.
 :cl1 raw :privs %cl3-nick%
-:cl1 expect %srv2-name% 270 %cl1-nick% %cl3-nick% :CHAN_LIMIT
+:cl1 expect %srv2-name% 270 %cl3-nick% :CHAN_LIMIT
 
 # Synchronize everything
 sync cl1,cl2,cl3
Index: ircu2.10/tests/bug-1840011.cmd
diff -u /dev/null ircu2.10/tests/bug-1840011.cmd:1.1.2.1
--- /dev/null   Tue Nov 27 21:51:04 2007
+++ ircu2.10/tests/bug-1840011.cmd      Tue Nov 27 21:50:53 2007
@@ -0,0 +1,39 @@
+define srv1 localhost:7601
+define srv1-name irc.example.net
+define hidden-srv *.undernet.org
+define channel #random-channel
+define cl1-nick Ch4n0pm4n
+
+# Connect a client and join it to the test channel.
+connect cl1 %cl1-nick% op3rm4n %srv1% :Some Chanop
+:cl1 join %channel%
+
+# Issue a variety of bans, all of which should be accepted.
+:cl1 mode %channel% +b [EMAIL PROTECTED]/16
+:cl1 mode %channel% +b [EMAIL PROTECTED]
+:cl1 mode %channel% +b [EMAIL PROTECTED]
+:cl1 mode %channel% +b [EMAIL PROTECTED]
+:cl1 mode %channel% +b [EMAIL PROTECTED]
+
+# Check the modes on the channel.
+:cl1 mode %channel% +b
+# These regexps make my eyes bleed almost enough to add a load of code to 
test-driver.pl.
+# There's another test-driver problem here, too: one "expect" works fine, but 
a second
+# one never sees the second numeric response from the server.
+:cl1 expect %srv1-name% 367 %channel% [EMAIL PROTECTED] %cl1-nick% \\d+
+
+# Check that a more-encompassing ban removes the old bans.
+:cl1 mode %channel% +b [EMAIL PROTECTED]
+:cl1 expect %cl1-nick% mode %channel% -bb\\+b [EMAIL PROTECTED] [EMAIL 
PROTECTED]/16 [EMAIL PROTECTED]
+
+# Check that a narrower ban cannot be added.
+# Somewhat sadly, the first command gets no response at all.
+:cl1 mode %channel% +b [EMAIL PROTECTED]
+:cl1 mode %channel% +b
+:cl1 expect %srv1-name% 367 %channel% [EMAIL PROTECTED] %cl1-nick% \\d+
+
+# Can we remove a broader ban and add a narrow ban at the same time?
+# This was the core of the bug report (SF#1840011).
+:cl1 mode %channel% -b+b [EMAIL PROTECTED] [EMAIL PROTECTED]
+:cl1 expect %cl1-nick% mode %channel% -b\\+b [EMAIL PROTECTED] [EMAIL 
PROTECTED]
+:cl1 quit done
Index: ircu2.10/tests/test-driver.pl
diff -u ircu2.10/tests/test-driver.pl:1.1.2.2 
ircu2.10/tests/test-driver.pl:1.1.2.3
--- ircu2.10/tests/test-driver.pl:1.1.2.2       Mon Mar  5 18:35:24 2007
+++ ircu2.10/tests/test-driver.pl       Tue Nov 27 21:50:53 2007
@@ -297,12 +297,12 @@
       my $expect = $client->{expect}->[0];
       my $mismatch;
       $args = $args->[2]; # ->[1] is the entire string, ->[2] is split
-      for (my $x=2; ($x<=$#$expect) and ($x<=$#$args) and not $mismatch; $x++) 
{
-        if ($args->[$x] !~ /$expect->[$x]/i) {
+      for (my $x=0; ($x+2<=$#$expect) and ($x<=$#$args) and not $mismatch; 
$x++) {
+        my $expectation = $expect->[$x+2];
+        if ($args->[$x] !~ /$expectation/i) {
           $mismatch = 1;
-          print "Mismatch in arg $x: $args->[$x] !~ $expect->[$x]\n";
+          print "Mismatch in arg $x: $args->[$x] !~ $expectation\n";
         }
-        # $mismatch = 1 unless $args->[$x] =~ /$expect->[$x]/i;
       }
       unexpect($kernel, $session, $client) unless $mismatch;
     }
@@ -391,22 +391,10 @@
   my $expected = $client->{expect}->[0];
 
   # check sender
-  if ($expected->[0] =~ /\*(.+)/) {
-    # we expect *sessionname, so look up session's current nick
-    my $exp = $1;
-    $sender =~ /^(.+)!/;
-    return 0 if lc($heap->{clients}->{$exp}->{nick}) ne lc($1);
-  } elsif ($expected->[0] =~ /^:?(.+!.+)/) {
-    # expect :[EMAIL PROTECTED], so compare whole thing
-    return 0 if lc($1) ne lc($sender);
-  } else {
-    # we only expect :nick, so compare that part
-    $sender =~ /^:?(.+)!/;
-    return 0 if lc($expected->[0]) ne lc($1);
-  }
+  return 0 unless $sender =~ /^:?\Q$expected->[0]\E/i;
 
   # compare text
-  return 0 if lc($text) !~ /$expected->[2]/i;
+  return 0 unless $text =~ /$expected->[2]/i;
 
   # drop expectation of event
   unexpect($kernel, $session, $client);
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to