]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
plugin(points): forgot one special case, see #34
authorMatthias Hecker <mail@apoc.cc>
Mon, 13 Apr 2020 18:48:40 +0000 (20:48 +0200)
committerMatthias Hecker <mail@apoc.cc>
Mon, 13 Apr 2020 18:48:40 +0000 (20:48 +0200)
Tokens that include itself ++/-- are now ignored as well.

data/rbot/plugins/points.rb
test/plugins/test_points.rb

index 976594ee59e8cdcef9b950e0b3e2b7828b4aa1b9..2f67092f6bf5f07191a252e9fdf3d8856b0a05d7 100644 (file)
@@ -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:]]/
 
index d29b6174e44a541ac7aca01d35d9d5d6ccbdb5c3..b3386ed4769196bdecc3cb61ec6b10215c327124 100644 (file)
@@ -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|