TW-1719: Description cannot contain improper ordinals

- Thanks to Ben Boeckel.
This commit is contained in:
Paul Beckingham 2016-01-12 00:04:48 -05:00
parent 156357285c
commit e361c2c751
3 changed files with 17 additions and 4 deletions

View file

@ -25,6 +25,7 @@
- TW-1705 Directories in .task/hooks should not be reported as invalid hooks
(thanks to Tomas Babej).
- TW-1714 Starting recurring task starts all recurrences (thanks to Robin Green).
- TW-1719 Description cannot contain improper ordinals (thanks to Ben Boeckel).
- TW-1720 CmdContext uses a mix of both throw and std::cout to convey
errors (thanks to Paul Beckingham).
- TW-1723 task info causes segfault (thanks to Roman Golovin).

View file

@ -440,11 +440,7 @@ bool namedDates (const std::string& name, Variant& value)
value = Variant (mktime (t), Variant::type_date);
}
}
else
throw std::string (STRING_DATES_ORD_MISMATCH);
}
else
throw std::string (STRING_DATES_MONTH_31);
}
else if (closeEnough ("easter", name, minimum) ||

View file

@ -227,6 +227,22 @@ class TestBug1612(TestCase):
self.assertEqual("(bar) a / (foo bar)\n", out)
class TestBug1719(TestCase):
def setUp(self):
self.t = Task()
def test_improper_ordinals(self):
"""1719: Description cannot contain improper ordinals"""
self.t("add one 1th");
self.t("add two 23rd");
code, out, err = self.t("_get 1.description")
self.assertEqual("one 1th\n", out)
code, out, err = self.t("_get 2.description")
self.assertEqual("two 23rd\n", out)
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())