cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Cocci] [PATCH 12/13] tests: Add test case for assigned enumerator
Date: Sun,  8 Mar 2020 14:13:55 +0530	[thread overview]
Message-ID: <20200308084356.14506-13-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200308084356.14506-1-jaskaransingh7654321@gmail.com>

Add a test case to verify correct pretty printing of
enumerators that are assigned. The test case should cover
minused assigned enumerators, plussed assigned enumerators
and correct matching of an enum with an assigned enumerator.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
 tests/enum_assign.c     |  6 ++++++
 tests/enum_assign.cocci | 11 +++++++++++
 tests/enum_assign.res   |  7 +++++++
 3 files changed, 24 insertions(+)
 create mode 100644 tests/enum_assign.c
 create mode 100644 tests/enum_assign.cocci
 create mode 100644 tests/enum_assign.res

diff --git a/tests/enum_assign.c b/tests/enum_assign.c
new file mode 100644
index 00000000..9c2d16df
--- /dev/null
+++ b/tests/enum_assign.c
@@ -0,0 +1,6 @@
+enum h {
+	a = 0,
+	c,
+	x,
+	b
+};
diff --git a/tests/enum_assign.cocci b/tests/enum_assign.cocci
new file mode 100644
index 00000000..a1a59ef8
--- /dev/null
+++ b/tests/enum_assign.cocci
@@ -0,0 +1,11 @@
+@@
+@@
+
+enum h {
+  ...,
+- a = 0,
++ q = 0,
+  ...,
+  b,
++ z
+};
diff --git a/tests/enum_assign.res b/tests/enum_assign.res
new file mode 100644
index 00000000..3b204aa0
--- /dev/null
+++ b/tests/enum_assign.res
@@ -0,0 +1,7 @@
+enum h {
+	q = 0,
+	c,
+	x,
+	b,
+	z
+};
-- 
2.21.1

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  parent reply	other threads:[~2020-03-08  8:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-08  8:43 [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 01/13] parsing_cocci: Align " Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 02/13] ocaml: coccilib: Reflect changes in SmPL AST for EnumDef Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 03/13] parsing_cocci: parser: Parse enumerators correctly Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 04/13] parsing_cocci: Add EnumDeclTag and EnumDeclDotsTag to SmPL ASTs Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 05/13] ocaml: coccilib: Reflect EnumDeclTag and EnumDeclDotsTag Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 06/13] parsing_cocci: visitor_ast0: Add visitor functions for enum_decl Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 07/13] parsing_cocci: Reflect visitor_ast0 changes in parsing_cocci Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 08/13] parsing_cocci: Add visitor functions for enum_decl in visitor_ast Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 09/13] cocci: Reflect changes in SmPL visitor_ast in codebase Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 10/13] engine: cocci_vs_c: Match enumerators properly as per enum_decl Jaskaran Singh
2020-03-08  8:43 ` [Cocci] [PATCH 11/13] cocci: pretty print EnumDef as per enum_decl type Jaskaran Singh
2020-03-08  8:43 ` Jaskaran Singh [this message]
2020-03-08  8:43 ` [Cocci] [PATCH 13/13] tools: spgen: Reflect visitor changes Jaskaran Singh
2020-03-09 14:15 ` [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum Julia Lawall
2020-03-09 14:51   ` Jaskaran Singh
2020-03-09 12:53 [Cocci] [PATCH 12/13] tests: Add test case for assigned enumerator 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=20200308084356.14506-13-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.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).