diff --git a/tests/features/datetime.feature b/tests/features/datetime.feature index d28092ce..5c66b093 100644 --- a/tests/features/datetime.feature +++ b/tests/features/datetime.feature @@ -48,3 +48,22 @@ Feature: Reading and writing to journal with custom date formats | little_endian_dates.yaml | 2032-02-01: Test. | 01.02.2032 09:00 Test. | | little_endian_dates.yaml | 2020-01-01: Test. | 01.01.2020 09:00 Test. | | little_endian_dates.yaml | 2020-12-31: Test. | 31.12.2020 09:00 Test. | + + + Scenario Outline: Searching for dates with custom date + Given we use the config "" + When we run "jrnl " + Then the output should be "" + + Examples: Day-first Dates + | config_file | command | output | + | little_endian_dates.yaml | -on '2013-07-10' --short | 10.07.2013 15:40 Life is good. | + | little_endian_dates.yaml | -on 'june 9 2013' --short | 09.06.2013 15:39 My first entry. | + | little_endian_dates.yaml | -on 'july 10 2013' --short | 10.07.2013 15:40 Life is good. | + | little_endian_dates.yaml | -on 'june 2013' --short | 09.06.2013 15:39 My first entry. | + | little_endian_dates.yaml | -on 'july 2013' --short | 10.07.2013 15:40 Life is good. | + # @todo month alone with no year should work + # | little_endian_dates.yaml | -on 'june' --short | 09.06.2013 15:39 My first entry. | + # | little_endian_dates.yaml | -on 'july' --short | 10.07.2013 15:40 Life is good. | + + diff --git a/tests/step_defs/conftest.py b/tests/step_defs/conftest.py index 99825ff8..c6ad8d6a 100644 --- a/tests/step_defs/conftest.py +++ b/tests/step_defs/conftest.py @@ -114,6 +114,17 @@ def check_output_inline(output, cli_run): assert output and output in cli_run["stdout"] +@then(parse("the output should be\n{output}")) +@then(parse('the output should be "{output}"')) +@then('the output should be ""') +def test_check_output_inline(output, cli_run): + actual_out = cli_run["stdout"].strip() + output = output.strip() + assert ( + output and output == actual_out + ), f"Output does not match.\nExpected:\n{output}\n---end---\nActual:\n{actual_out}\n---end---\n" + + @then(parse('the output should be "{expected_out}"')) @then(parse("the output should be\n{expected_out}")) def check_output(cli_run, expected_out):