Skip to content

Commit

Permalink
Added regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Feb 24, 2022
1 parent fc9a384 commit 8539669
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions restructuredtext_lint/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
warning_rst = os.path.join(_dir, 'test_files', 'second_short_heading.rst')
dir_rst = os.path.join(_dir, 'test_files', 'dir')
invalid_rst = os.path.join(_dir, 'test_files', 'invalid.rst')
missing_rst = os.path.join(_dir, 'test_files', 'missing.rst')
rst_lint_path = os.path.join(_dir, os.pardir, 'cli.py')

"""
Expand Down Expand Up @@ -171,6 +172,16 @@ def test_rst_lint_folder(self):
# Verify exactly 1 error is produced
self.assertEqual(output.count('WARNING'), 1)

def test_rst_lint_missing_file(self):
"""
The `rst-lint` command should print errors for files inside folders.
Fixes regression https://github.com/twolfson/restructuredtext-lint/issues/58
"""
with self.assertRaises(subprocess.CalledProcessError) as e:
subprocess.check_output((sys.executable, rst_lint_path, missing_rst), universal_newlines=True)
output = str(e.exception.output)
self.assertIn('not found as a file nor directory', output)

def test_rst_lint_many_files(self):
"""The `rst-lint` command accepts many rst file paths and prints respective information for each of them."""
with self.assertRaises(subprocess.CalledProcessError) as e:
Expand Down

0 comments on commit 8539669

Please sign in to comment.