From f280d574f420b22e84adcb60b89701e0f7b7c28e Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Fri, 14 Apr 2017 18:35:18 +0530 Subject: [PATCH] Sunrise: Handles "at date" queries (#4082) * quickfix adding at queries * Added tests --- lib/DDG/Goodie/SunInfo.pm | 2 +- t/SunInfo.t | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/DDG/Goodie/SunInfo.pm b/lib/DDG/Goodie/SunInfo.pm index 0c4a82c4c..2d23c4957 100755 --- a/lib/DDG/Goodie/SunInfo.pm +++ b/lib/DDG/Goodie/SunInfo.pm @@ -34,7 +34,7 @@ handle remainder => sub { (?$lat_lon_regex[NS])\s (?$lat_lon_regex[EW])\s? )? - (?:on|for)?\s? + (?:on|for|at)?\s? (?$datestring_regex)? $/xi; diff --git a/t/SunInfo.t b/t/SunInfo.t index b28f09f60..a024c589a 100755 --- a/t/SunInfo.t +++ b/t/SunInfo.t @@ -126,6 +126,34 @@ ddg_goodie_test( } } ), + 'sunset 7th of march 2017' => test_zci("On 07 Mar 2017, sunrise in Phoenixville, Pennsylvania is at 6:24 AM; sunset at 6:00 PM", + structured_answer => { + data => ignore(), + templates => { + group => 'text', + item => 0, + options => { + title_content => 'DDH.sun_info.title', + content => 'DDH.sun_info.content' + } + } + } + ), + 'sunset at 7 March 2017' => test_zci("On 07 Mar 2017, sunrise in Phoenixville, Pennsylvania is at 6:24 AM; sunset at 6:00 PM", + structured_answer => { + data => ignore(), + templates => { + group => 'text', + item => 0, + options => { + title_content => 'DDH.sun_info.title', + content => 'DDH.sun_info.content' + } + } + } + ), + + 'sunset for philly' => undef, 'sunrise on mars' => undef, 'sunset boulevard' => undef,