From: Matthias Hecker Date: Mon, 13 Apr 2020 18:48:40 +0000 (+0200) Subject: plugin(points): forgot one special case, see #34 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=cc241a9709593491b6a67810ed8a5a5054e19208;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git plugin(points): forgot one special case, see #34 Tokens that include itself ++/-- are now ignored as well. --- diff --git a/data/rbot/plugins/points.rb b/data/rbot/plugins/points.rb index 976594ee..2f67092f 100644 --- a/data/rbot/plugins/points.rb +++ b/data/rbot/plugins/points.rb @@ -85,6 +85,9 @@ class PointsPlugin < Plugin token = $1 # strip ++/-- from token flag = $2 # remember ++/-- + # token must not have more than one ++/-- + next if token.match(/(\+\+|--)/) + # each token must include at least one alphanumerical character next unless token.match /[[:alnum:]]/ diff --git a/test/plugins/test_points.rb b/test/plugins/test_points.rb index d29b6174..b3386ed4 100644 --- a/test/plugins/test_points.rb +++ b/test/plugins/test_points.rb @@ -72,6 +72,8 @@ class PointsPluginTest < Test::Unit::TestCase ' --', '++ --', '-- ++', + '+rw+r++r++', + '-rw-r--r--', 'https://linux.slashdot.org/story/20/04/12/2138205/how-red-hats-new-ceo-handles-life-under-ibm----and-a-global-pandemic' ] ignored.each do |ignore|