add test to ensure there are no \r

some of the specs are coming in with literal \r characters,
probably from being created in windows notepad. This makes reading
the specs very cumbersome. We should test against these.

Change-Id: I59ed022e882cfde00c004a66659a43134fd2df5c
This commit is contained in:
Sean Dague 2014-05-09 07:27:04 -04:00
parent f52cf2ffc3
commit e71dedc6b4
2 changed files with 342 additions and 333 deletions

View File

@ -11,6 +11,7 @@
# under the License. # under the License.
import glob import glob
import re
import docutils.core import docutils.core
import testtools import testtools
@ -80,6 +81,13 @@ class TestTitles(testtools.TestCase):
msg="%s:%d: Line limited to a maximum of 79 characters." % msg="%s:%d: Line limited to a maximum of 79 characters." %
(tpl, i+1)) (tpl, i+1))
def _check_no_cr(self, tpl, raw):
matches = re.findall('\r', raw)
self.assertEqual(
len(matches), 0,
"Found %s literal carriage returns in file %s" %
(len(matches), tpl))
def test_template(self): def test_template(self):
files = ['specs/template.rst'] + glob.glob('specs/*/*') files = ['specs/template.rst'] + glob.glob('specs/*/*')
for filename in files: for filename in files:
@ -92,3 +100,4 @@ class TestTitles(testtools.TestCase):
titles = self._get_titles(spec) titles = self._get_titles(spec)
self._check_titles(titles) self._check_titles(titles)
self._check_lines_wrapping(filename, data) self._check_lines_wrapping(filename, data)
self._check_no_cr(filename, data)