mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TI-64: Command 'stop' with date before current interval's start date causes segfault
- Show error message if stop date is before current interval's start date - Add test for this use case
This commit is contained in:
parent
403b1c6f5e
commit
e505129d5c
2 changed files with 11 additions and 0 deletions
|
@ -62,7 +62,12 @@ int CmdStop (
|
|||
// If a stop date is specified (and occupies filter.range.start) then use
|
||||
// that instead of the current time.
|
||||
if (filter.range.start.toEpoch () != 0)
|
||||
{
|
||||
if (modified.range.start >= filter.range.start)
|
||||
throw std::string ("The end of a date range must be after the start.");
|
||||
|
||||
modified.range.end = filter.range.start;
|
||||
}
|
||||
else
|
||||
modified.range.end = Datetime ();
|
||||
|
||||
|
|
|
@ -65,6 +65,12 @@ class TestStop(TestCase):
|
|||
self.assertIn('0100Z', j[0]['start'])
|
||||
self.assertIn('0200Z', j[0]['end'])
|
||||
|
||||
def test_invalid_stop(self):
|
||||
"""Verify stop date after start date is an error"""
|
||||
self.t("start 20160516T100200")
|
||||
code, out, err = self.t.runError("stop 20160516T090100")
|
||||
self.assertIn("The end of a date range must be after the start.", err)
|
||||
|
||||
def test_stop_all(self):
|
||||
"""Start three tags, stop"""
|
||||
self.t("start 5mins ago one two three")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue