Fix DayOne tag sample data, move search/format tag tests, and run them on multiple jrnl types

This commit is contained in:
Micah Jerome Ellison 2020-09-26 13:16:13 -07:00
parent 4df0aef67a
commit 932996a846
6 changed files with 165 additions and 140 deletions

View file

@ -31,7 +31,11 @@ conubia nostra, per inceptos himenaeos.</string>
<key>UUID</key> <key>UUID</key>
<string>D04D335AFED711EABA18FAFFC2100C3D</string> <string>D04D335AFED711EABA18FAFFC2100C3D</string>
<key>Tags</key> <key>Tags</key>
<array/> <array>
<string>ipsum</string>
<string>tagone</string>
<string>tagtwo</string>
</array>
<key>Creator</key> <key>Creator</key>
<dict> <dict>
<key>Device Agent</key> <key>Device Agent</key>

View file

@ -35,7 +35,9 @@ Quisque auctor lacinia consectetur.</string>
<key>UUID</key> <key>UUID</key>
<string>FC8A86CAFED711EA8892FAFFC2100C3D</string> <string>FC8A86CAFED711EA8892FAFFC2100C3D</string>
<key>Tags</key> <key>Tags</key>
<array/> <array>
<string>tagtwo</string>
</array>
<key>Creator</key> <key>Creator</key>
<dict> <dict>
<key>Device Agent</key> <key>Device Agent</key>

View file

@ -23,7 +23,10 @@ ante eget fringilla. @tagthree and also @tagone</string>
<key>UUID</key> <key>UUID</key>
<string>FD8ABC8EFED711EABC35FAFFC2100C3D</string> <string>FD8ABC8EFED711EABC35FAFFC2100C3D</string>
<key>Tags</key> <key>Tags</key>
<array/> <array>
<string>tagthree</string>
<string>tagone</string>
</array>
<key>Creator</key> <key>Creator</key>
<dict> <dict>
<key>Device Agent</key> <key>Device Agent</key>

View file

@ -12,6 +12,40 @@ Feature: Custom formats
And entry 1 should have an array "tags" with 2 elements And entry 1 should have an array "tags" with 2 elements
And entry 2 should have an array "tags" with 2 elements And entry 2 should have an array "tags" with 2 elements
Scenario Outline: Printing a journal that has multiline entries with tags
Given we use the config "<config>.yaml"
When we run "jrnl -n 1 @ipsum"
Then we should get no error
And the output should be
"""
2020-08-29 11:11 Entry the first.
| Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
| quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus
| pellentesque
| augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
| consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In
| commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget
| venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo.
|
| Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
| ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. Suspendisse
| potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas eget
| molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed lectus
| hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
| feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, vestibulum
| urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod enim.
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
| velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
| porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
| conubia nostra, per inceptos himenaeos.
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario: Exporting using filters should only export parts of the journal Scenario: Exporting using filters should only export parts of the journal
Given we use the config "tags.yaml" Given we use the config "tags.yaml"
When we run "jrnl -until 'may 2013' --export json" When we run "jrnl -until 'may 2013' --export json"

View file

@ -68,7 +68,6 @@ Feature: Searching in a journal
| basic_folder | | basic_folder |
| basic_dayone | | basic_dayone |
@todo # Day One tag search is broken
Scenario Outline: Searching for a string within tag results Scenario Outline: Searching for a string within tag results
Given we use the config "<config>.yaml" Given we use the config "<config>.yaml"
When we run "jrnl @tagone -contains maybe" When we run "jrnl @tagone -contains maybe"
@ -79,9 +78,8 @@ Feature: Searching in a journal
| config | | config |
| basic_onefile | | basic_onefile |
| basic_folder | | basic_folder |
#| basic_dayone | | basic_dayone |
@todo # Day One tag search is broken
Scenario Outline: Searching for a string within AND tag results Scenario Outline: Searching for a string within AND tag results
Given we use the config "<config>.yaml" Given we use the config "<config>.yaml"
When we run "jrnl -and @tagone @tagtwo -contains maybe" When we run "jrnl -and @tagone @tagtwo -contains maybe"
@ -92,9 +90,8 @@ Feature: Searching in a journal
| config | | config |
| basic_onefile | | basic_onefile |
| basic_folder | | basic_folder |
#| basic_dayone | | basic_dayone |
@todo # Day One tag search is broken
Scenario Outline: Searching for a string within NOT tag results Scenario Outline: Searching for a string within NOT tag results
Given we use the config "<config>.yaml" Given we use the config "<config>.yaml"
When we run "jrnl -not @tagone -contains lonesome" When we run "jrnl -not @tagone -contains lonesome"
@ -105,7 +102,7 @@ Feature: Searching in a journal
| config | | config |
| basic_onefile | | basic_onefile |
| basic_folder | | basic_folder |
#| basic_dayone | | basic_dayone |
Scenario Outline: Searching for dates Scenario Outline: Searching for dates
Given we use the config "<config>.yaml" Given we use the config "<config>.yaml"
@ -119,7 +116,7 @@ Feature: Searching in a journal
| config | | config |
| basic_onefile | | basic_onefile |
| basic_folder | | basic_folder |
#| basic_dayone | | basic_dayone |
Scenario: Out of order entries to a Folder journal should be listed in date order Scenario: Out of order entries to a Folder journal should be listed in date order
Given we use the config "empty_folder.yaml" Given we use the config "empty_folder.yaml"
@ -135,8 +132,69 @@ Feature: Searching in a journal
2014-03-07 16:37 Second entry of journal. 2014-03-07 16:37 Second entry of journal.
""" """
# fails when system time is UTC (as on Travis-CI) Scenario Outline: Searching for all tags should show counts of each tag
@skip Given we use the config "<config>.yaml"
When we run "jrnl --tags"
Then we should get no error
And the output should be
"""
@tagtwo : 2
@tagone : 2
@tagthree : 1
@ipsum : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Filtering journals should also filter tags
Given we use the config "<config>.yaml"
When we run "jrnl -from 'september 2020' --tags"
Then we should get no error
And the output should be
"""
@tagthree : 1
@tagone : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Excluding a tag should filter out all entries with that tag
Given we use the config "<config>.yaml"
When we run "jrnl --tags -not @tagtwo"
Then the output should be
"""
@tagthree : 1
@tagone : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Excluding multiple tags should filter out all entries with those tags
Given we use the config "<config>.yaml"
When we run "jrnl --tags -not @tagone -not @tagthree"
Then the output should be
"""
@tagtwo : 1
"""
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario: DayOne tag searching should work with tags containing a mixture of upper and lower case. Scenario: DayOne tag searching should work with tags containing a mixture of upper and lower case.
# https://github.com/jrnl-org/jrnl/issues/354 # https://github.com/jrnl-org/jrnl/issues/354
Given we use the config "dayone.yaml" Given we use the config "dayone.yaml"

View file

@ -1,29 +1,11 @@
Feature: Tagging Feature: Tagging
# See search.feature for tag-related searches
# And format.feature for tag-related output
Scenario: Displaying tags Scenario Outline: Tags should allow certain special characters such as /, +, #
Given we use the config "tags.yaml" Given we use the config "<config>.yaml"
When we run "jrnl --tags" When we run "jrnl 2020-09-26: This is an entry about @os/2 and @c++ and @c#"
Then we should get no error When we run "jrnl --tags -on 2020-09-26"
And the output should be
"""
@idea : 2
@journal : 1
@dan : 1
"""
Scenario: Filtering journals should also filter tags
Given we use the config "tags.yaml"
When we run "jrnl -from 'may 2013' --tags"
Then we should get no error
And the output should be
"""
@idea : 1
@dan : 1
"""
Scenario: Tags should allow certain special characters
Given we use the config "tags-216.yaml"
When we run "jrnl --tags"
Then we should get no error Then we should get no error
And the output should be And the output should be
""" """
@ -32,114 +14,56 @@ Feature: Tagging
@c# : 1 @c# : 1
""" """
Scenario: An email should not be a tag Examples: configs
Given we use the config "tags-237.yaml" | config |
When we run "jrnl --tags" | basic_onefile |
Then we should get no error | basic_folder |
And the output should be | basic_dayone |
"""
@newline : 1
@email : 1
"""
Scenario: Entry cans start and end with tags Scenario Outline: Emails addresses should not be parsed as tags
Given we use the config "simple.yaml" Given we use the config "<config>.yaml"
When we run "jrnl today: @foo came over, we went to a @bar" When we run "jrnl 2020-09-26: The email address test@example.com doesn't seem to work for me"
When we run "jrnl --tags" When we run "jrnl 2020-09-26: The email address test@example.org also doesn't work for me"
When we run "jrnl 2020-09-26: I tried test@example.org and test@example.edu too"
Then we flush the output
When we run "jrnl --tags -on 2020-09-26"
Then we should get no error
And the output should be "[No tags found in journal.]"
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Emails addresses should not be parsed as tags
Given we use the config "<config>.yaml"
When we run "jrnl 2020-09-26: The email address test@example.com doesn't seem to work for me"
When we run "jrnl 2020-09-26: The email address test@example.org also doesn't work for me"
When we run "jrnl 2020-09-26: I tried test@example.org and test@example.edu too"
Then we flush the output
When we run "jrnl --tags -on 2020-09-26"
Then we should get no error
And the output should be "[No tags found in journal.]"
Examples: configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Entry can start and end with tags
Given we use the config "<config>.yaml"
When we run "jrnl 2020-09-26: @foo came over, we went to a @bar"
When we run "jrnl --tags -on 2020-09-26"
Then the output should be Then the output should be
""" """
@foo : 1 @foo : 1
@bar : 1 @bar : 1
""" """
Scenario: Excluding a tag should filter it Examples: configs
Given we use the config "simple.yaml" | config |
When we run "jrnl today: @foo came over, we went to a bar" | basic_onefile |
When we run "jrnl I have decided I did not enjoy that @bar" | basic_folder |
When we run "jrnl --tags -not @bar" | basic_dayone |
Then the output should be
"""
@foo : 1
"""
Scenario: Excluding a tag should filter an entry, even if an unfiltered tag is in that entry
Given we use the config "simple.yaml"
When we run "jrnl today: I do @not think this will show up @thought"
When we run "jrnl today: I think this will show up @thought"
When we run "jrnl --tags -not @not"
Then the output should be
"""
@thought : 1
"""
Scenario: Excluding multiple tags should filter them
Given we use the config "simple.yaml"
When we run "jrnl today: I do @not think this will show up @thought"
And we run "jrnl today: I think this will show up @thought"
And we run "jrnl today: This should @never show up @thought"
And we run "jrnl today: What a nice day for filtering @thought"
And we run "jrnl --tags -not @not -not @never"
Then the output should be
"""
@thought : 2
"""
Scenario: Printing a journal that has multiline entries with tags
Given we use the config "multiline-tags.yaml"
When we run "jrnl -n 1"
Then we should get no error
And the output should be
"""
2013-06-09 15:39 Multiple @line entry with @tags.
| Tag with @punctuation. afterwards
| @TagOnLineAloneWithOutPunctuation
| @TagOnLineAloneWithPunctuation.
| Text before @tag. And After.
| @hi. Hello
| hi Hello
"""
Scenario: Searching a journal for tags should display entries with that tag.
Given we use the config "tags.yaml"
When we run "jrnl @dan"
Then the output should be
"""
2013-06-10 15:40 I met with @dan.
| As alway's he shared his latest @idea on how to rule the world with me.
| inst
"""
Scenario: Searching a journal for multiple tags with -and should display entries with those tags.
Given we use the config "tags.yaml"
When we run "jrnl -and @idea @journal"
Then the output should be
"""
2013-04-09 15:39 I have an @idea:
| (1) write a command line @journal software
| (2) ???
| (3) PROFIT!
"""
Scenario: Loading tags from a DayOne Journal
Given we use the config "dayone.yaml"
When we run "jrnl --tags"
Then the output should be
"""
@work : 1
@play : 1
"""
Scenario: Saving tags from a DayOne Journal
Given we use the config "dayone.yaml"
When we run "jrnl A hard day at @work"
And we run "jrnl --tags"
Then the output should be
"""
@work : 2
@play : 1
"""
Scenario: Filtering by tags from a DayOne Journal
Given we use the config "dayone.yaml"
When we run "jrnl @work"
Then the output should be "2013-05-17 11:39 This entry has tags!"