diff options
-rw-r--r-- | src/times.cc | 3 | ||||
-rw-r--r-- | test/regress/1074.test | 161 |
2 files changed, 162 insertions, 2 deletions
diff --git a/src/times.cc b/src/times.cc index b527de87..45734bdc 100644 --- a/src/times.cc +++ b/src/times.cc @@ -839,7 +839,7 @@ void date_parser_t::determine_when(date_parser_t::lexer_t::token_t& tok, specifier.month = date_specifier_t::month_type (boost::get<date_time::months_of_year>(*tok.value)); - tok = lexer.next_token(); + tok = lexer.peek_token(); switch (tok.kind) { case lexer_t::token_t::TOK_A_YEAR: specifier.year = boost::get<date_specifier_t::year_type>(*tok.value); @@ -847,7 +847,6 @@ void date_parser_t::determine_when(date_parser_t::lexer_t::token_t& tok, case lexer_t::token_t::END_REACHED: break; default: - tok.unexpected(); break; } break; diff --git a/test/regress/1074.test b/test/regress/1074.test new file mode 100644 index 00000000..1aaf0ca0 --- /dev/null +++ b/test/regress/1074.test @@ -0,0 +1,161 @@ + +--input-date-format %Y-%m-%d +--date-format %Y-%m-%d + +2011-06-01 * Jun 2011 + A $10 + B + +2011-07-01 * Jul 2011 + A $10 + B + +2011-08-01 * Aug 2011 + A $10 + B + +2012-06-01 * Jun 2012 + A $10 + B + +2012-07-01 * Jul 2012 + A $10 + B + +2012-08-01 * Aug 2012 + A $10 + B + +2013-06-01 * Jun 2013 + A $10 + B + +2013-07-01 * Jul 2013 + A $10 + B + +2013-08-01 * Aug 2013 + A $10 + B + +2014-06-01 * Jun 2014 + A $10 + B + +2014-07-01 * Jul 2014 + A $10 + B + +2014-08-01 * Aug 2014 + A $10 + B + +2015-06-01 * Jun 2015 + A $10 + B + +2015-07-01 * Jul 2015 + A $10 + B + +2015-08-01 * Aug 2015 + A $10 + B + +test --now 2012-02-03 reg -p "from june to july" +2012-06-01 Jun 2012 A $10 $10 + B $-10 0 +end test + +test --now 2013-02-03 reg -p "from june to july" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +end test + +test --now 2014-02-03 reg -p "from june to july" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2014-10-02 reg -p "from june to july" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2012-02-03 reg -p "from june to july 2014" +2012-06-01 Jun 2012 A $10 $10 + B $-10 0 +2012-07-01 Jul 2012 A $10 $10 + B $-10 0 +2012-08-01 Aug 2012 A $10 $10 + B $-10 0 +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2013-10-02 reg -p "from june to july 2014" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2014-01-02 reg -p "from june to july 2014" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2014-10-02 reg -p "from june to july 2014" +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2012-02-03 reg -p "from june 2012 to july 2014" +2012-06-01 Jun 2012 A $10 $10 + B $-10 0 +2012-07-01 Jul 2012 A $10 $10 + B $-10 0 +2012-08-01 Aug 2012 A $10 $10 + B $-10 0 +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2012-02-03 reg -p "from june 2013 to july 2014" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + +test --now 2015-02-03 reg -p "from june 2013 to july 2014" +2013-06-01 Jun 2013 A $10 $10 + B $-10 0 +2013-07-01 Jul 2013 A $10 $10 + B $-10 0 +2013-08-01 Aug 2013 A $10 $10 + B $-10 0 +2014-06-01 Jun 2014 A $10 $10 + B $-10 0 +end test + |