From f7f9439d76937accf13ae24388ff4b61841edbf6 Mon Sep 17 00:00:00 2001 From: Ben Moon Date: Mon, 23 May 2016 12:24:10 +0100 Subject: [PATCH] Fix MagicEightBall tests (#3138) We don't need to enc the response. --- lib/DDG/Goodie/MagicEightBall.pm | 2 +- t/MagicEightBall.t | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/DDG/Goodie/MagicEightBall.pm b/lib/DDG/Goodie/MagicEightBall.pm index 164c25433..e919536aa 100755 --- a/lib/DDG/Goodie/MagicEightBall.pm +++ b/lib/DDG/Goodie/MagicEightBall.pm @@ -42,7 +42,7 @@ handle remainder => sub { return $response, structured_answer => { data => { - title => html_enc($response), + title => $response, subtitle => "Magic eight ball's answer to: ".html_enc($_) }, templates => { diff --git a/t/MagicEightBall.t b/t/MagicEightBall.t index e0ab2b0e4..e6423b98c 100755 --- a/t/MagicEightBall.t +++ b/t/MagicEightBall.t @@ -9,13 +9,13 @@ use DDG::Test::Goodie; zci answer_type => "magic_eight_ball"; zci is_cached => 0; -my $possibleAnswers = re(qr/(It is certain|It is decidedly so|Without a doubt|Yes, definitely|You may rely on it|As I see it, yes|Most likely|Outlook good|Yes|Signs point to yes|Reply hazy try again|Ask again later|Better not tell you now|Cannot predict now|Concentrate and ask again|Don(?:'|')t count on it|My reply is no|My sources say no|Outlook not so good|Very doubtful)/); +my $possibleAnswers = re(qr/(It is certain|It is decidedly so|Without a doubt|Yes, definitely|You may rely on it|As I see it, yes|Most likely|Outlook good|Yes|Signs point to yes|Reply hazy try again|Ask again later|Better not tell you now|Cannot predict now|Concentrate and ask again|Don't count on it|My reply is no|My sources say no|Outlook not so good|Very doubtful)/); sub build_test { my ($input) = @_; return test_zci($possibleAnswers, structured_answer =>{ data => { - title => $possibleAnswers, + title => $possibleAnswers, subtitle => "Magic eight ball's answer to: $input" }, templates => { @@ -30,8 +30,8 @@ ddg_goodie_test( 'magic 8 ball should I wear red today?' => build_test('should I wear red today?'), 'magic eight-ball are you actually helpful' => build_test('are you actually helpful'), 'eight ball will this work?' => undef, - 'magic 8ball Yes?' => undef, - 'magic 8ball' => undef + 'magic 8ball Yes?' => undef, + 'magic 8ball' => undef ); done_testing;