diff options
-rw-r--r-- | testsuite/pyunit/libghdl/Comments.py | 17 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/func.vhdl | 8 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/func_fail.vhdl | 8 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/func_param.vhdl | 9 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/func_param_fail.vhdl | 9 |
5 files changed, 50 insertions, 1 deletions
diff --git a/testsuite/pyunit/libghdl/Comments.py b/testsuite/pyunit/libghdl/Comments.py index 46b5956f4..7bdffba11 100644 --- a/testsuite/pyunit/libghdl/Comments.py +++ b/testsuite/pyunit/libghdl/Comments.py @@ -63,6 +63,8 @@ class Instantiate(TestCase): self.checkFlist(nodes.Get_Elements_Declaration_List(tdef)) elif defk == nodes.Iir_Kind.Enumeration_Type_Definition: self.checkFlist(nodes.Get_Enumeration_Literal_List(tdef)) + elif k in nodes.Iir_Kinds.Subprogram_Declaration: + self.checkDecls(nodes.Get_Interface_Declaration_Chain(decl)) decl = nodes.Get_Chain(decl) def checkConc(self, first) -> None: @@ -241,6 +243,19 @@ class Instantiate(TestCase): def test_enumlit_2(self) -> None: self.checkFile(self._root / "enumlit_2.vhdl") -# TODO: subprograms, subprogram parameters + @expectedFailure + def test_func_fail(self) -> None: + self.checkFile(self._root / "func_fail.vhdl") + + def test_func(self) -> None: + self.checkFile(self._root / "func.vhdl") + + @expectedFailure + def test_func_param_fail(self) -> None: + self.checkFile(self._root / "func_param_fail.vhdl") + + def test_func_param(self) -> None: + self.checkFile(self._root / "func_param.vhdl") + # TODO: first comment # Empty line before to easy cut & put diff --git a/testsuite/pyunit/libghdl/func.vhdl b/testsuite/pyunit/libghdl/func.vhdl new file mode 100644 index 000000000..df9fcd9a2 --- /dev/null +++ b/testsuite/pyunit/libghdl/func.vhdl @@ -0,0 +1,8 @@ +package p is + constant c : natural := 1; + + -- :log2: as functions are longer in definitions, it might be written before + function log2(param : positive) return natural; +end p; + + diff --git a/testsuite/pyunit/libghdl/func_fail.vhdl b/testsuite/pyunit/libghdl/func_fail.vhdl new file mode 100644 index 000000000..6b71cc6f2 --- /dev/null +++ b/testsuite/pyunit/libghdl/func_fail.vhdl @@ -0,0 +1,8 @@ +package p is + constant c : natural := 1; + + -- as functions are longer in definitions, it might be written before + function log2(param : positive) return natural; +end p; + + diff --git a/testsuite/pyunit/libghdl/func_param.vhdl b/testsuite/pyunit/libghdl/func_param.vhdl new file mode 100644 index 000000000..fb47687e5 --- /dev/null +++ b/testsuite/pyunit/libghdl/func_param.vhdl @@ -0,0 +1,9 @@ +package p is + function log2( + -- :param1: we also want to document parameters too + param1 : integer; + param2 : boolean + ) return natural; +end p; + + diff --git a/testsuite/pyunit/libghdl/func_param_fail.vhdl b/testsuite/pyunit/libghdl/func_param_fail.vhdl new file mode 100644 index 000000000..53461fdd9 --- /dev/null +++ b/testsuite/pyunit/libghdl/func_param_fail.vhdl @@ -0,0 +1,9 @@ +package p is + function log2( + -- we also want to document parameters too + param1 : integer; + param2 : boolean + ) return natural; +end p; + + |