linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: julia.lawall@inria.fr, jaskaransingh7654321@gmail.com,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Linux-kernel-mentees] [PATCH 2/2] tests: Add test case for user comments attached to ident
Date: Fri, 10 Jan 2020 22:41:50 +0530	[thread overview]
Message-ID: <20200110171150.14695-3-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200110171150.14695-1-jaskaransingh7654321@gmail.com>

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 <jaskaransingh7654321@gmail.com>
---
 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

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  parent reply	other threads:[~2020-01-10 17:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 17:11 [Linux-kernel-mentees] [PATCH 0/2] cocci: Support user comments attached to identifiers Jaskaran Singh
2020-01-10 17:11 ` [Linux-kernel-mentees] [PATCH 1/2] parsing_c: Support user comments attached to identifier Jaskaran Singh
2020-01-10 17:11 ` Jaskaran Singh [this message]
2020-01-10 18:39   ` [Linux-kernel-mentees] [Cocci] [PATCH 2/2] tests: Add test case for user comments attached to identifiers Markus Elfring
2020-01-11  9:18   ` [Linux-kernel-mentees] [Cocci] [2/2] " Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200110171150.14695-3-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).