Commit Graph

90 Commits (master)

Author SHA1 Message Date
Rob Emery e3cb2380e9 DatesRole: Adding support for partial time format (#4187)
* DatesRole: Failing tests for new relative date + time format

* DatesRole: Adding support for queries like "03 may 07:00"
2017-05-24 22:36:46 -04:00
Rob Emery 264282b374 DateRole: Handling 'of' in textual date formats (#3982)
* DateRole: Adding failing test for `$nth of $month $year`

* DateRole: Now parses "7th of march 2017"

* DateRole: Adding failing test for '5 of jan 1993' (no suffix and short month)

* DateRole: Handles 5 of march

* DateRole: Now also handle "march the 30th, 2017"
2017-04-10 23:02:06 -04:00
Rob Emery 3ae96df2f8 NumbersRole: Isn't correctly case-insensitive currently (#4000)
* NumbersRole: No tests covering exponentials

* NumbersRole: Improving test coverage

* NumbersRole: Despite the role being case insensitive, the number_style_regex isn't! Adding failing test

* NumbersRole: number_style_regex now case insensitive

* NumbersRole: Fixing indentation
2017-03-16 13:32:24 -04:00
Ben Moon ebf686c6a1 Allow lowercase trailing TZs
E.g., cet rather than CET
2016-02-03 19:31:34 +00:00
Ben Moon d03b322428 Add additional time-zone checks
Just adding in some tests that accidentally got changed.
2016-02-03 19:31:34 +00:00
Ben Moon 5a8bdf1b90 Fix some whitespace 2016-02-03 19:30:22 +00:00
Ben Moon 9033120b8a Correct some tests 2016-02-03 19:30:22 +00:00
Ben Moon 47daa8b593 Update to fall-back on time-zone offset 2016-02-03 19:30:22 +00:00
Ben Moon fd97b48e33 Add support for 24hr clock in display 2016-02-03 19:30:22 +00:00
Ben Moon db88b11d1d Add support for %d %b %Y %T %Z format
Essentially HTTP format without the day and allowing any timezone.
2016-02-03 19:30:22 +00:00
Zaahir Moolla 03651cc8b8 Merge pull request #1294 from duckduckgo/mintsoft/date-role/relatives
DateRole: Tests and fixes
2015-09-11 16:43:59 -04:00
Rob Emery c7cbfd8862 DatesRole: Tabs to spaces! 2015-09-06 18:24:04 +01:00
Rob Emery 91b9107669 Adding tests around is_valid_year 2015-07-31 21:48:40 +01:00
Rob Emery 3a57bb68bf DatesRole: Adding more tests and commenting out failing tests 2015-07-15 22:11:30 +01:00
Rob Emery bcdc3997fa DatesRole: Adding tests around mixing strong and relative dates 2015-07-15 22:04:40 +01:00
Rob Emery e17fb515ed Merge branch 'master' of https://github.com/Bujiraso/zeroclickinfo-goodies into Bujiraso-master 2015-07-15 21:46:43 +01:00
Rob Emery 7c415b18c4 DatesRole: This test would fail if it was ever executed. It shouldn't be here at all 2015-07-14 22:30:11 +01:00
Bujiraso 096fd0ffce Dates role now parses relative terms from today 2015-07-12 13:54:27 +00:00
Bujiraso d45f03a0d8 Fixed Dates role to copy an object before using it 2015-07-12 02:20:24 +00:00
Christian Aistleitner 846d9715a0 Fix casing of 'suffix' argument for temp files in tests
The role tests failed with Perl <5.17.10 installs, due to the used
File::Temp (<0.23) still caring about the casing of the
arguments. Newer versions of File::Temp no longer care about the
casing.

By uppercasing 'suffix' in the tests, we make the tests pass for both
Perl 5.16 and Perl 5.18.
2015-03-11 15:09:45 +01:00
Rob Emery 3db537d529 DatesRole: parse_all_datestrings_to_date will now use the first date as a base for ambiguous formats 2015-02-01 17:39:43 +00:00
Rob Emery f0e00bf120 DatesRole: Adding tests defining the behaviour around naked months 2015-02-01 16:42:03 +00:00
Matt Miller 9fa8c14464 NumberStyler: allow for space and underscore separation.
This allows people to enter numbers in a more visually kind way,
without breaking the general paradigm.
2014-11-14 00:01:15 +02:00
Matt Miller 665dd0c3e5 DatesRole: grab $loc info off the calling package.
As one might suspect, the testing is the difficult part with per-instance
"package variables.

I welcome more comprehensive tests, but I don't know that I am up to
creating them.
2014-10-31 18:27:53 +02:00
Rob Emery 5afd7b823b DatesRole: Fixing copy+paste failure on tests 2014-10-31 18:27:09 +02:00
Rob Emery c5005910ee DatesRole: Readding all tests 2014-10-31 18:27:09 +02:00
Rob Emery 8b7ec46353 DatesRole: Re-adding failing tests (the regex doesn't match!) 2014-10-31 18:27:09 +02:00
Rob Emery 1ce8e865c1 DatesRole: Adding explicit test for matching the descriptive_datestring_regex 2014-10-31 18:27:09 +02:00
Rob Emery ae3688378e DatesRole: Commenting out tests that fail; leaving in "in a <unit>" as these pass?! 2014-10-31 18:26:31 +02:00
Rob Emery 9fe459441c DatesRole: Restoring failing tests 2014-10-31 18:26:31 +02:00
Rob Emery 98d0adb403 DatesRole: refactoring into utility function 2014-10-31 18:26:31 +02:00
Rob Emery 3ca4f6ccf5 DatesRole: Expanding test coverage and first (probably broken) implementation 2014-10-31 18:26:31 +02:00
Rob Emery cf246bb9d4 DatesRole: Adding regex and failing tests for new proseque formats 2014-10-31 18:26:31 +02:00
Matt Miller ab20f6c8e0 DatesRole: add "this" week|month|year.
At this point,all of them are essentially aliases for "today", but the
logic is kept separate in case we want to move them to start of period
or similar.

Minor update on Chinese Zodiac to demonstrate it working through the
role instead of local triggering.
2014-10-31 18:26:31 +02:00
Matt Miller ffd257aa09 DatesRole: fix and expand relative dates.
- Add grouping to regex for proper |ing.
- Add 'year' to relative dates.  (See Chinese zodiac)
- Add more tests.
2014-10-31 18:26:31 +02:00
Rob Emery 98ef4b7899 DatesRole: Adding regex and failing tests for relative day parsig 2014-10-31 18:25:59 +02:00
Matt Miller 5b35a56dc5 ImageLoader: use more standard methods to get at package symbols.
This may allwo for some code-sharing later.
2014-10-29 12:48:33 +02:00
Matt Miller 15f905a61d ImageLoader: expand silly symbol table tricks for `html_enc`
This way we can get proper quoting in the tag attributes,instead ofmy
silly incorrect version.
2014-10-29 12:48:33 +02:00
Matt Miller c8eac15915 ImageLoader: add role to use images from share.
- Load images from the share as safely as possible.
- Craft <img> tag with data url as source, plus additional supplied
  attributes.
2014-10-29 12:48:33 +02:00
Matt Miller da70710f7d EOL: remove trailing whitespace. 2014-10-28 20:36:15 +02:00
Matt Miller 17fc1447c9 DatesRole: add RFC2822 support. 2014-09-07 18:36:48 -04:00
Matt Miller 97f737e0be DatesRole: support standard output of date(1).
- Convert to ISO-8601 for the parse.
- Support short month to number in service of above.
- Support TZ to UTC offset in service of above.

In cases where the TZ abbreviation was ambiguous I selected what I
deemed to be the most populous or most likely to be a DDG user's intent.
I may, of course, be wrong.

Fixes #621.
2014-09-07 17:42:03 -04:00
Matt Miller 73ccf7282e DatesRole: complete deprecation cycle.
- Deprecate 'parse_all_strings_to_date()' in favor of
  'parse_all_datestrings_to_date()' for consistency.
- Remove the deprecated functions.
- Update all calls.
2014-08-31 19:21:55 -04:00
Matt Miller 4af3339501 00-roles.t: Update test output message. 2014-08-31 16:36:40 -04:00
Rob Emery ab0fdb6b04 DatesRole: Switching tests to use new parse_datestring_to_date 2014-08-31 19:42:45 +01:00
Rob Emery ce0880b158 DatesRole: renaming and deprecating parse_string_to_date 2014-08-31 19:39:37 +01:00
Rob Emery 5701ac4322 DatesRole: Added failing tests to layout desired behaviour of parse_string_to_date 2014-08-31 19:31:39 +01:00
Rob Emery 03632703fb DatesRole: Switching invalid string tests from parse_string_to_date to parse_formatted_datestring_to_date 2014-08-31 19:15:46 +01:00
Rob Emery fbc38176b3 DatesRole: Adding tests for the formatted_datestring_regex and switching existing tests to use it versus the date_regex() 2014-08-31 19:08:50 +01:00
Rob Emery 35137b382c DatesRole: Adding tests for new datestring_regex methods and renaming existing regex 2014-08-31 19:04:43 +01:00