mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
CmdStart: Honor the :adjust flag when overwriting a currently open interval
Move the adjustment of a new open interval that is enclosed by the current open interval into the validation processing, where the other overlap resolution takes place. This will allow the start command to honor the :adjust flag when starting a new interval that predates the current open interval. Closes #326 Signed-off-by: Shaun Ruffell <sruffell@sruffell.net> Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
1c1066ae6c
commit
cc82f468e1
3 changed files with 43 additions and 57 deletions
13
test/start.t
13
test/start.t
|
@ -27,11 +27,10 @@
|
|||
###############################################################################
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from datetime import datetime, timedelta, time
|
||||
|
||||
import sys
|
||||
|
||||
# Ensure python finds the local simpletap module
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
@ -102,7 +101,7 @@ class TestStart(TestCase):
|
|||
|
||||
code, out, err = self.t.runError("start BAR 1h ago")
|
||||
|
||||
self.assertIn("The end of a date range must be after the start.", err)
|
||||
self.assertIn("You cannot overlap intervals. Correct the start/end time, or specify the :adjust hint.", err)
|
||||
|
||||
def test_start_with_start_date_earlier_than_closed_interval(self):
|
||||
"""Test start with start date earlier than closed interval"""
|
||||
|
@ -261,12 +260,18 @@ class TestStart(TestCase):
|
|||
"""Start will not silently fail when tags are the same and time is earlier"""
|
||||
self.t("start 1h ago proja")
|
||||
code, out, err = self.t.runError("start 2h ago proja")
|
||||
self.assertIn("The end of a date range must be after the start.", err)
|
||||
self.assertIn("You cannot overlap intervals. Correct the start/end time, or specify the :adjust hint", err)
|
||||
|
||||
def test_start_will_error_with_all_hint(self):
|
||||
"""Start will return an error when passed the :all hint"""
|
||||
code, out, err = self.t.runError("start :all proja")
|
||||
|
||||
def test_start_with_start_date_earlier_than_closed_interval_with_adjust(self):
|
||||
"""Start will honor the :adjust hint when overlapping an open interval"""
|
||||
self.t("start 1h ago proja")
|
||||
code, out, err = self.t("start 2h ago proja :adjust")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from simpletap import TAPTestRunner
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue