From 50bb72dff74159a44ab85432d938a86828602409 Mon Sep 17 00:00:00 2001 From: Rohit Upadhyay Date: Tue, 5 Sep 2017 23:30:32 +0530 Subject: [PATCH] Game2048: Fixed overtriggering (#4473) * fixed overtriggering in Game2048 * Added two more tests to help fix issue #4473 * Added regex guard in handle function to fix #4473. * modified regex guard for #4473 * Added a test to t/Game2048.t * Removed trailing comma. --- lib/DDG/Goodie/Game2048.pm | 2 +- t/Game2048.t | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/DDG/Goodie/Game2048.pm b/lib/DDG/Goodie/Game2048.pm index f25a66f59..a95254ca6 100644 --- a/lib/DDG/Goodie/Game2048.pm +++ b/lib/DDG/Goodie/Game2048.pm @@ -9,7 +9,7 @@ triggers start => "2048", "play 2048", "game 2048"; handle query_lc => sub { - return unless $_; + return unless $_ =~ /^(2048|play 2048|game 2048)(\s+.*)*$/; return '', structured_answer => { diff --git a/t/Game2048.t b/t/Game2048.t index 5ec74dc73..b58395f11 100644 --- a/t/Game2048.t +++ b/t/Game2048.t @@ -40,7 +40,10 @@ ddg_goodie_test( ), 'what is 2048?' => undef, 'how to play 2048' => undef, - '204823 34232' => undef + '204823 34232' => undef, + '123:play 2048:12398' => undef, + '2400:cb00:2048:1::6817:f2fe' => undef, + '2048:6093:99ca:bc7:0:0:0:0' => undef );