diff options
Diffstat (limited to 'rtemsspec')
-rw-r--r-- | rtemsspec/content.py | 2 | ||||
-rw-r--r-- | rtemsspec/tests/test_content.py | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/rtemsspec/content.py b/rtemsspec/content.py index 3a25b7ec..ee7b2b3d 100644 --- a/rtemsspec/content.py +++ b/rtemsspec/content.py @@ -385,11 +385,13 @@ class Content: def add_blank_line(self): """ Adds a blank line. """ self._lines.append("") + self._gap = False def ensure_blank_line(self): """ Ensures that the last line is blank. """ if not self._lines or self._lines[-1]: self._lines.append("") + self._gap = False def register_license(self, the_license: str) -> None: """ Registers a licence for the content. """ diff --git a/rtemsspec/tests/test_content.py b/rtemsspec/tests/test_content.py index 8383ca8e..123128d4 100644 --- a/rtemsspec/tests/test_content.py +++ b/rtemsspec/tests/test_content.py @@ -89,6 +89,32 @@ def test_add(): b c """ + content = Content("BSD-2-Clause", True) + content.add("a") + assert str(content) == """a +""" + content.add_blank_line() + assert str(content) == """a + +""" + content.add("b") + assert str(content) == """a + +b +""" + content = Content("BSD-2-Clause", True) + content.add("a") + assert str(content) == """a +""" + content.ensure_blank_line() + assert str(content) == """a + +""" + content.add("b") + assert str(content) == """a + +b +""" def test_wrap(): |