summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-11 16:29:55 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-11 16:57:59 +0200
commit82ee7cecf052ce11dbfe0e05719c44744b906ecc (patch)
tree38f4c2701ea84f5e3571d1b3637a86ab539e4332
parente36a4ccc50c9d8a745c9114a3630cf4b7b77c70a (diff)
downloadrtems-central-82ee7cecf052ce11dbfe0e05719c44744b906ecc.tar.bz2
content: Split long @defgroup lines
-rw-r--r--rtemsspec/content.py5
-rw-r--r--rtemsspec/tests/test_content_c.py22
2 files changed, 26 insertions, 1 deletions
diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 131f8fe..5e8da8b 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -651,7 +651,10 @@ class CContent(Content):
def open_defgroup_block(self, identifier: str, name: str) -> None:
""" Opens a Doxygen @defgroup comment block. """
- self._open_comment_block(["/**", f" * @defgroup {identifier} {name}"])
+ defgroup = [f" * @defgroup {identifier} {name}"]
+ if len(self._indent) + len(defgroup[0]) > 79:
+ defgroup = [f" * @defgroup {identifier} \\", f" * {name}"]
+ self._open_comment_block(["/**"] + defgroup)
self.gap = True
def open_function_block(self, function: str) -> None:
diff --git a/rtemsspec/tests/test_content_c.py b/rtemsspec/tests/test_content_c.py
index 5cf3702..8a24caf 100644
--- a/rtemsspec/tests/test_content_c.py
+++ b/rtemsspec/tests/test_content_c.py
@@ -455,6 +455,28 @@ b
"""
+def test_defgroup():
+ content = CContent()
+ with content.defgroup_block("a", "b"):
+ content.add("c")
+ assert str(content) == """/**
+ * @defgroup a b
+ *
+ * c
+ */
+"""
+ content = CContent()
+ with content.defgroup_block(
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"):
+ pass
+ assert str(content) == """/**
+ * @defgroup aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \\
+ * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ */
+"""
+
+
def test_prepend_copyrights_and_licenses():
content = CContent()
content.add("x")