When comments were appended to an identifier passed from python to cocci or ocaml to cocci, two cases showed pretty printing errors. Add a test case for both of the erroneous cases.
Signed-off-by: Jaskaran Singh <[email protected]> --- tests/id_comments.c | 4 ++++ tests/id_comments.cocci | 19 +++++++++++++++++++ tests/id_comments.res | 6 ++++++ 3 files changed, 29 insertions(+) create mode 100644 tests/id_comments.c create mode 100644 tests/id_comments.cocci create mode 100644 tests/id_comments.res diff --git a/tests/id_comments.c b/tests/id_comments.c new file mode 100644 index 00000000..b92f346b --- /dev/null +++ b/tests/id_comments.c @@ -0,0 +1,4 @@ +foo () { + const void * const id; + pgd_t *__meminit id; +} diff --git a/tests/id_comments.cocci b/tests/id_comments.cocci new file mode 100644 index 00000000..971616a5 --- /dev/null +++ b/tests/id_comments.cocci @@ -0,0 +1,19 @@ +@ r0 @ +type t; +position p; +@@ +t@p + +@ script:python r1 @ +id; +@@ +coccinelle.id = "id/* user comment */" + +@ r2 @ +identifier r1.id; +type r0.t; +@@ +foo() { +... +++ t id; +} diff --git a/tests/id_comments.res b/tests/id_comments.res new file mode 100644 index 00000000..b29ac113 --- /dev/null +++ b/tests/id_comments.res @@ -0,0 +1,6 @@ +foo() { + const void * const id; + pgd_t *__meminit id; + const void *const id/* user comment */; + pgd_t *__meminit id/* user comment */; +} -- 2.21.1 _______________________________________________ Cocci mailing list [email protected] https://systeme.lip6.fr/mailman/listinfo/cocci
