mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-01 06:46:14 +02:00
Add test for empty stdin input
This commit is contained in:
parent
91dcb812d7
commit
455261c55e
2 changed files with 18 additions and 1 deletions
|
@ -20,12 +20,20 @@ Feature: Basic reading and writing to a journal
|
||||||
When we run "jrnl -n 1"
|
When we run "jrnl -n 1"
|
||||||
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
|
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
|
||||||
|
|
||||||
# Note that the expected output is actually "[Nothing saved to file]" but due to mocking limitations, we expect no output here.
|
|
||||||
Scenario: Writing an empty entry from the editor
|
Scenario: Writing an empty entry from the editor
|
||||||
Given we use the config "editor.yaml"
|
Given we use the config "editor.yaml"
|
||||||
When we open the editor and enter ""
|
When we open the editor and enter ""
|
||||||
Then we should see the message "[Nothing saved to file]"
|
Then we should see the message "[Nothing saved to file]"
|
||||||
|
|
||||||
|
Scenario: Writing an empty entry from the command line
|
||||||
|
Given we use the config "basic.yaml"
|
||||||
|
When we run "jrnl ''"
|
||||||
|
Then we should get no error
|
||||||
|
And the unstripped output should be
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
Scenario: Filtering for dates
|
Scenario: Filtering for dates
|
||||||
Given we use the config "basic.yaml"
|
Given we use the config "basic.yaml"
|
||||||
When we run "jrnl -on 2013-06-10 --short"
|
When we run "jrnl -on 2013-06-10 --short"
|
||||||
|
|
|
@ -211,6 +211,15 @@ def check_output(context, text=None):
|
||||||
for line_text, line_out in zip(text, out):
|
for line_text, line_out in zip(text, out):
|
||||||
assert line_text.strip() == line_out.strip(), [line_text.strip(), line_out.strip()]
|
assert line_text.strip() == line_out.strip(), [line_text.strip(), line_out.strip()]
|
||||||
|
|
||||||
|
@then('the unstripped output should be')
|
||||||
|
@then('the unstripped output should be "{text}"')
|
||||||
|
def check_output(context, text=None):
|
||||||
|
text = (text or context.text).splitlines()
|
||||||
|
out = context.stdout_capture.getvalue().splitlines()
|
||||||
|
assert len(text) == len(out), "Output has {} lines (expected: {})".format(len(out), len(text))
|
||||||
|
for line_text, line_out in zip(text, out):
|
||||||
|
assert line_text == line_out, [line_text, line_out]
|
||||||
|
|
||||||
|
|
||||||
@then('the output should contain "{text}" in the local time')
|
@then('the output should contain "{text}" in the local time')
|
||||||
def check_output_time_inline(context, text):
|
def check_output_time_inline(context, text):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue