diff --git a/features/data/configs/upgrade_from_195.json b/features/data/configs/upgrade_from_195.json new file mode 100644 index 00000000..ec380372 --- /dev/null +++ b/features/data/configs/upgrade_from_195.json @@ -0,0 +1,11 @@ +{ +"default_hour": 9, +"timeformat": "%Y-%m-%d %H:%M", +"linewrap": 80, +"encrypt": false, +"editor": "", +"default_minute": 0, +"highlight": true, +"journals": {"default": "features/journals/simple_jrnl-1-9-5.journal"}, +"tagsymbols": "@" +} diff --git a/features/data/journals/simple_jrnl-1-9-5.journal b/features/data/journals/simple_jrnl-1-9-5.journal index 66d8439c..f660305b 100644 --- a/features/data/journals/simple_jrnl-1-9-5.journal +++ b/features/data/journals/simple_jrnl-1-9-5.journal @@ -1,5 +1,3 @@ -2013-06-09 15:39 My first entry. -Everything is alright +2010-06-10 15:00 A life without chocolate is like a bad analogy. -2013-06-10 15:40 Life is good. -But I'm better. +2013-06-10 15:40 He said "[this] is the best time to be alive". diff --git a/features/regression.feature b/features/regression.feature index 3018ea10..6013b804 100644 --- a/features/regression.feature +++ b/features/regression.feature @@ -38,16 +38,26 @@ Feature: Zapped bugs should stay dead. 2013-10-27 03:27 Some text. """ - Scenario: Title with an embedded period. - Given we use the config "basic.yaml" - When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic." - Then we should see the message "Entry added" - When we run "jrnl -1" - Then the output should be - """ - 2014-04-24 09:00 Created a new website - empty.com. - | Hope to get a lot of traffic. - """ + Scenario: Title with an embedded period. + Given we use the config "basic.yaml" + When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic." + Then we should see the message "Entry added" + When we run "jrnl -1" + Then the output should be + """ + 2014-04-24 09:00 Created a new website - empty.com. + | Hope to get a lot of traffic. + """ + + Scenario: Upgrade and parse journals with square brackets + Given we use the config "upgrade_from_195.json" + When we run "jrnl -2" and enter "Y" + Then the output should contain + """ + 2010-06-10 15:00 A life without chocolate is like a bad analogy. + + 2013-06-10 15:40 He said "[this] is the best time to be alive". + """ Scenario: Title with an embedded period on DayOne journal Given we use the config "dayone.yaml" diff --git a/features/steps/core.py b/features/steps/core.py index fadaefc2..3e0b1de8 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -162,8 +162,10 @@ def check_output_time_inline(context, text): assert local_date in out, local_date +@then('the output should contain') @then('the output should contain "{text}"') -def check_output_inline(context, text): +def check_output_inline(context, text=None): + text = text or context.text out = context.stdout_capture.getvalue() if isinstance(out, bytes): out = out.decode('utf-8')