]> iEval git - poe-component-irc-plugin-hello.git/blobdiff - t/POE-Component-IRC-Plugin-Hello.t
Allow ! or . after a greeting
[poe-component-irc-plugin-hello.git] / t / POE-Component-IRC-Plugin-Hello.t
index ebb2ef597dd35746ba8c0810548304e87810f74c..526f0bf27cd4b363ba339759b4c5a3bf2b6d4fb2 100644 (file)
@@ -1,13 +1,13 @@
+#!/usr/bin/perl -w
 use v5.14;
 use strict;
 use warnings;
 
-use Test::More tests => 15;
+use Test::More tests => 18;
 use Test::MockObject;
 
 BEGIN { use_ok('POE::Component::IRC::Plugin::Hello') };
 
-# Variable setup
 my $hello_sent;
 
 my $mockirc = Test::MockObject->new;
@@ -16,20 +16,20 @@ $mockirc->mock(yield => sub { $hello_sent = 1 })->set_always(nick_name => 'hello
 my $self = POE::Component::IRC::Plugin::Hello->new;
 my $channels = [ '#chan' ];
 
-# Sub setup
 sub runtest{
-  my ($message, $expect, $comment) = @_;
-  $hello_sent=0;
-  $self->S_public($mockirc, \'mgv!marius@ieval.ro', \$channels, \$message);
-  ok($hello_sent == $expect, $comment)
+       my ($message, $expect, $comment) = @_;
+       $hello_sent=0;
+       $self->S_public($mockirc, \'mgv!marius@ieval.ro', \$channels, \$message);
+       ok($hello_sent == $expect, $comment)
 }
 
-#Tests
 runtest 'privet', 1, 'simple privet';
 runtest 'PrIvEt', 1, 'privet in mixed case';
 runtest '  privet  ', 1, 'privet with spaces';
 runtest 'hellobot: privet', 1, 'addressed privet';
 runtest 'hellobot:    privet   ', 1, 'addressed privet with spaces';
+runtest 'privet!', 1, 'privet with exclamation mark';
+runtest 'privet.', 1, 'privet with full stop';
 runtest 'ahoy', 1, 'ahoy';
 runtest 'namaste', 1, 'namaste';
 runtest 'neaţa', 1, 'neaţa (UTF-8 test)';
@@ -38,8 +38,8 @@ runtest 'こんにちは', 1, 'こんにちは (another UTF-8 test)';
 runtest 'salu', 0, 'salu (misspelling)';
 runtest 'hii', 0, 'hii (misspelling)';
 runtest 'neaţa mgv', 0, 'neaţa mgv (valid greeting with garbage after it)';
+runtest 'hi,', 0, 'hi, (bad punctuation)';
 
 $self = POE::Component::IRC::Plugin::Hello->new(greetings => ['sayonara']);
-
 runtest 'privet', 0, 'custom greetings - privet';
 runtest '  sayonara   ', 1, 'custom greetings - sayonara';
This page took 0.010633 seconds and 4 git commands to generate.