Skip to content

Commit 77b995a

Browse files
committed
tests: Add tests to cover creation of uppercase tags
1 parent d136845 commit 77b995a

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

tests/test_viewport.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,22 @@ def execute(self):
667667
# testfile3 only has header, so refresh on open makes changes
668668
self.client.edit(testfile3)
669669
assert self.client.eval('&modified') == '1'
670+
671+
672+
class TestViewportsUppercaseTags(MultiSyntaxIntegrationTest):
673+
674+
viminput = """
675+
HEADER2(Outworldly tasks | +UFO)
676+
"""
677+
678+
vimoutput = """
679+
HEADER2(Outworldly tasks | +UFO)
680+
* [ ] catch the flying saucer #{uuid}
681+
"""
682+
683+
tasks = [
684+
dict(description="catch the flying saucer", tags=['UFO']),
685+
]
686+
687+
def execute(self):
688+
self.command("w", regex="written$", lines=1)

tests/test_vwtask_parsing.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,33 @@ def test_not_modstring(self):
104104
vwtask = self.VimwikiTask.from_line(self.cache, 0)
105105

106106
assert vwtask['description'] == u"Task https://somewhere/dash--dash"
107+
108+
def test_added_modstring_with_tag(self):
109+
self.cache.buffer[0] = "* [ ] Home task -- +home"
110+
vwtask = self.VimwikiTask.from_line(self.cache, 0)
111+
112+
assert vwtask['description'] == u"Home task"
113+
assert vwtask['tags'] == {"home"}
114+
assert vwtask['priority'] == None
115+
assert vwtask['due'] == None
116+
assert vwtask['uuid'] == None
117+
118+
def test_added_modstring_with_uppercase_tag(self):
119+
self.cache.buffer[0] = "* [ ] Home task -- +HOME"
120+
vwtask = self.VimwikiTask.from_line(self.cache, 0)
121+
122+
assert vwtask['description'] == u"Home task"
123+
assert vwtask['tags'] == {"HOME"}
124+
assert vwtask['priority'] == None
125+
assert vwtask['due'] == None
126+
127+
def test_added_modstring_with_virtual_tag_ignored(self):
128+
self.cache.buffer[0] = "* [ ] Home task -- +OVERDUE"
129+
vwtask = self.VimwikiTask.from_line(self.cache, 0)
130+
131+
assert vwtask['description'] == u"Home task"
132+
assert vwtask['tags'] == set()
133+
assert vwtask['priority'] == None
134+
assert vwtask['due'] == None
135+
assert vwtask['uuid'] == None
136+
assert vwtask['uuid'] == None

0 commit comments

Comments
 (0)