mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Merge pull request #1 from micahellison/eigenric/develop
Eigenric/develop
This commit is contained in:
commit
f17a8571d1
3 changed files with 34 additions and 4 deletions
|
@ -300,15 +300,15 @@ class Journal:
|
||||||
or (
|
or (
|
||||||
strict
|
strict
|
||||||
and all(
|
and all(
|
||||||
substring in entry.title.casefold()
|
substring in entry.title.casefold()
|
||||||
or substring in entry.body.casefold()
|
or substring in entry.body.casefold()
|
||||||
for substring in contains_lower
|
for substring in contains_lower
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
or (
|
or (
|
||||||
not strict
|
not strict
|
||||||
and any(
|
and any(
|
||||||
substring in entry.title.casefold()
|
substring in entry.title.casefold()
|
||||||
or substring in entry.body.casefold()
|
or substring in entry.body.casefold()
|
||||||
for substring in contains_lower
|
for substring in contains_lower
|
||||||
)
|
)
|
||||||
|
|
|
@ -86,6 +86,36 @@ Feature: Searching in a journal
|
||||||
| basic_folder.yaml |
|
| basic_folder.yaml |
|
||||||
| basic_dayone.yaml |
|
| basic_dayone.yaml |
|
||||||
|
|
||||||
|
Scenario Outline: Multiple -contains returns entries that match any
|
||||||
|
Given we use the config "<config_file>"
|
||||||
|
When we run "jrnl -contains emojis -contains lorem --short"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should contain "3 entries found"
|
||||||
|
And the output should be
|
||||||
|
2020-08-29 11:11 Entry the first.
|
||||||
|
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||||
|
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||||
|
|
||||||
|
Examples: configs
|
||||||
|
| config_file |
|
||||||
|
| basic_onefile.yaml |
|
||||||
|
| basic_folder.yaml |
|
||||||
|
| basic_dayone.yaml |
|
||||||
|
|
||||||
|
Scenario Outline: Multiple -contains with -and returns only entries that match all
|
||||||
|
Given we use the config "<config_file>"
|
||||||
|
When we run "jrnl -contains emojis -contains nulla -and --short"
|
||||||
|
Then we should get no error
|
||||||
|
And the output should contain "1 entry found"
|
||||||
|
And the output should be
|
||||||
|
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||||
|
|
||||||
|
Examples: configs
|
||||||
|
| config_file |
|
||||||
|
| basic_onefile.yaml |
|
||||||
|
| basic_folder.yaml |
|
||||||
|
| basic_dayone.yaml |
|
||||||
|
|
||||||
Scenario Outline: Searching for a string within tag results
|
Scenario Outline: Searching for a string within tag results
|
||||||
Given we use the config "<config_file>"
|
Given we use the config "<config_file>"
|
||||||
When we run "jrnl @tagone -contains maybe"
|
When we run "jrnl @tagone -contains maybe"
|
||||||
|
|
|
@ -55,7 +55,7 @@ def test_empty():
|
||||||
|
|
||||||
|
|
||||||
def test_contains_alone():
|
def test_contains_alone():
|
||||||
assert cli_as_dict("-contains whatever") == expected_args(contains="whatever")
|
assert cli_as_dict("-contains whatever") == expected_args(contains=["whatever"])
|
||||||
|
|
||||||
|
|
||||||
def test_debug_alone():
|
def test_debug_alone():
|
||||||
|
|
Loading…
Add table
Reference in a new issue