From d2a0fe9e9c097a5130a6d6a6f2c8c76bf4394ae0 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 23 Nov 2022 07:56:08 +0100 Subject: testsuite/pyunit/libghdl: add tests for process comments --- testsuite/pyunit/libghdl/Comments.py | 10 ++++++++++ testsuite/pyunit/libghdl/process.vhdl | 9 +++++++++ testsuite/pyunit/libghdl/process_fail.vhdl | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 testsuite/pyunit/libghdl/process.vhdl create mode 100644 testsuite/pyunit/libghdl/process_fail.vhdl (limited to 'testsuite/pyunit') diff --git a/testsuite/pyunit/libghdl/Comments.py b/testsuite/pyunit/libghdl/Comments.py index 7bdffba11..2c426a626 100644 --- a/testsuite/pyunit/libghdl/Comments.py +++ b/testsuite/pyunit/libghdl/Comments.py @@ -73,6 +73,9 @@ class Instantiate(TestCase): k = nodes.Get_Kind(stmt) if k in nodes.Iir_Kinds.Process_Statement: self.checkDecls(nodes.Get_Declaration_Chain(stmt)) + id = nodes.Get_Identifier(stmt) + if id != name_table.Null_Identifier: + self.checkComments(stmt, name_table.Get_Name_Ptr(id)) stmt = nodes.Get_Chain(stmt) def checkFile(self, filename) -> None: @@ -257,5 +260,12 @@ class Instantiate(TestCase): def test_func_param(self) -> None: self.checkFile(self._root / "func_param.vhdl") + @expectedFailure + def test_process_fail(self) -> None: + self.checkFile(self._root / "process_fail.vhdl") + + def test_process(self) -> None: + self.checkFile(self._root / "process.vhdl") + # TODO: first comment # Empty line before to easy cut & put diff --git a/testsuite/pyunit/libghdl/process.vhdl b/testsuite/pyunit/libghdl/process.vhdl new file mode 100644 index 000000000..c0b56fe6e --- /dev/null +++ b/testsuite/pyunit/libghdl/process.vhdl @@ -0,0 +1,9 @@ +architecture arch of e is + signal s, s_n : bit; +begin + -- Comment for :p: + p : process (s) + begin + s <= not s_n; + end process; +end arch; diff --git a/testsuite/pyunit/libghdl/process_fail.vhdl b/testsuite/pyunit/libghdl/process_fail.vhdl new file mode 100644 index 000000000..819e5ea6e --- /dev/null +++ b/testsuite/pyunit/libghdl/process_fail.vhdl @@ -0,0 +1,9 @@ +architecture arch of e is + signal s, s_n : bit; +begin + -- Comment + p : process (s) + begin + s <= not s_n; + end process; +end arch; -- cgit v1.2.3