mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-23 02:23:07 +02:00
tests: Test proper precise detection of vimwiki links
This commit is contained in:
parent
8a5306e4c2
commit
4b55082413
2 changed files with 27 additions and 1 deletions
|
@ -68,6 +68,7 @@ class IntegrationTest(object):
|
||||||
def configure_global_varialbes(self):
|
def configure_global_varialbes(self):
|
||||||
self.command('let g:taskwiki_data_location="{0}"'.format(self.dir))
|
self.command('let g:taskwiki_data_location="{0}"'.format(self.dir))
|
||||||
self.command('let g:taskwiki_taskrc_location="{0}"'.format(self.taskrc_path))
|
self.command('let g:taskwiki_taskrc_location="{0}"'.format(self.taskrc_path))
|
||||||
|
self.command("let g:vimwiki_list = [{'syntax': 'mediawiki', 'ext': '.txt','path': '%s'}]" % self.dir)
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
self.generate_data()
|
self.generate_data()
|
||||||
|
@ -171,7 +172,7 @@ class IntegrationTest(object):
|
||||||
# Helper function that fills in {uuid} placeholders with correct UUIDs
|
# Helper function that fills in {uuid} placeholders with correct UUIDs
|
||||||
def fill_uuid(self, line):
|
def fill_uuid(self, line):
|
||||||
# Tasks in testing can have only alphanumerical descriptions
|
# Tasks in testing can have only alphanumerical descriptions
|
||||||
match = re.match(u'\\s*\\* \\[.\\] (?P<desc>[äéôa-zA-Z0-9 ]*)(?<!\\s)', line,
|
match = re.match(u'\\s*\\* \\[.\\] (?P<desc>[äéôa-zA-Z0-9 \[\]]*)(?<!\\s)', line,
|
||||||
flags=re.UNICODE)
|
flags=re.UNICODE)
|
||||||
|
|
||||||
if not match:
|
if not match:
|
||||||
|
|
|
@ -355,6 +355,31 @@ class TestInfoActionTriggeredByEnter(IntegrationTest):
|
||||||
assert re.search(data2, output, re.MULTILINE)
|
assert re.search(data2, output, re.MULTILINE)
|
||||||
|
|
||||||
|
|
||||||
|
class TestInfoActionNotTriggeredByEnterOnLink(IntegrationTest):
|
||||||
|
|
||||||
|
viminput = """
|
||||||
|
* [ ] [[link task]] 1 #{uuid}
|
||||||
|
* [ ] test task 2 #{uuid}
|
||||||
|
"""
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
dict(description="[[link task]] 1"),
|
||||||
|
dict(description="test task 2"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.client.type('1gg')
|
||||||
|
self.client.type('10l')
|
||||||
|
self.client.feedkeys("\\<CR>")
|
||||||
|
sleep(0.5)
|
||||||
|
|
||||||
|
# Make sure we have been sent to a new buffer
|
||||||
|
output = '\n'.join(self.read_buffer())
|
||||||
|
|
||||||
|
assert not self.py("print(vim.current.buffer)", silent=False).startswith("<buffer info")
|
||||||
|
assert not output
|
||||||
|
|
||||||
|
|
||||||
class TestInfoActionMoved(IntegrationTest):
|
class TestInfoActionMoved(IntegrationTest):
|
||||||
|
|
||||||
viminput = """
|
viminput = """
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue