Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tweak testsuite so we no longer need any TODOs

  • Loading branch information...
commit ffe417972be8f58499063f52d4853f4be556ded8 1 parent 5fa9a12
@apocalypse apocalypse authored
Showing with 37 additions and 5 deletions.
  1. +1 −1  lib/POE/Component/IRC/Plugin/Karma.pm
  2. +36 −4 t/parsing.t
View
2  lib/POE/Component/IRC/Plugin/Karma.pm
@@ -274,7 +274,6 @@ sub _karma {
} else {
# get the list of karma matches
- # TODO still needs a bit more work, see t/parsing.t
my @matches = ( $args{'str'} =~ /(\([^\)]+\)|\S+)(\+\+|--)\s*(\#.+)?/g );
if ( @matches ) {
my @replies;
@@ -285,6 +284,7 @@ sub _karma {
# Is it a selfkarma?
if ( ! $self->selfkarma and lc( $karma ) eq lc( $args{'nick'} ) ) {
+ # TODO add selfkarma penalty?
next;
} else {
# clean the comment
View
40 t/parsing.t
@@ -155,37 +155,69 @@ my %tests = (
'c' => 'nice i like++ this awesome++ # stuff',
},
],
+
+ # those may be "incorrect" at first glance but it actually is the right behavior
+ # as the comment is not for a karma, so we are "allowed" to parse it for the karma words
+ # in it, and this makes things a bit more complicated
'foo++ this # awesome comment++' => [
{
- 'TODO' => 1,
'k' => 'foo',
'm' => '++',
'c' => undef,
},
+ {
+ 'k' => 'comment',
+ 'm' => '++',
+ 'c' => undef,
+ },
],
'(a foo)++ this # comment++' => [
{
- 'TODO' => 1,
'k' => 'a foo',
'm' => '++',
'c' => undef,
},
+ {
+ 'k' => 'comment',
+ 'm' => '++',
+ 'c' => undef,
+ },
],
'foo++ this # awesome comment++ # hey' => [
{
- 'TODO' => 1,
'k' => 'foo',
'm' => '++',
'c' => undef,
},
+ {
+ 'k' => 'comment',
+ 'm' => '++',
+ 'c' => 'hey',
+ },
],
'(a foo)++ this # comment++ # hola' => [
{
- 'TODO' => 1,
'k' => 'a foo',
'm' => '++',
'c' => undef,
},
+ {
+ 'k' => 'comment',
+ 'm' => '++',
+ 'c' => 'hola',
+ },
+ ],
+ '(a foo)++ this # comment++ # hola this++ should not work++ # another comment++' => [
+ {
+ 'k' => 'a foo',
+ 'm' => '++',
+ 'c' => undef,
+ },
+ {
+ 'k' => 'comment',
+ 'm' => '++',
+ 'c' => 'hola this++ should not work++ # another comment++',
+ },
],
# Oh, a certain idiot just got a nice 60" tv and wants to brag... ;)
Please sign in to comment.
Something went wrong with that request. Please try again.