Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Sunrise: Handles "at date" queries (#4082)
Browse files Browse the repository at this point in the history
* quickfix adding at queries

* Added tests
  • Loading branch information
nalinbhardwaj authored and moollaza committed Apr 14, 2017
1 parent 5ce2486 commit f280d57
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/DDG/Goodie/SunInfo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ handle remainder => sub {
(?<lat>$lat_lon_regex[NS])\s
(?<lon>$lat_lon_regex[EW])\s?
)?
(?:on|for)?\s?
(?:on|for|at)?\s?
(?<when>$datestring_regex)?
$/xi;

Expand Down
28 changes: 28 additions & 0 deletions t/SunInfo.t
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f280d57

Please sign in to comment.