Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* Re: [Cocci] [PATCH 12/13] tests: Add test case for assigned enumerator
@ 2020-03-09 12:53 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-03-09 12:53 UTC (permalink / raw)
  To: Jaskaran Singh, cocci; +Cc: linux-kernel-mentees

> minused assigned enumerators, plussed assigned enumerators

Does this description contain typos?

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Cocci] [PATCH 12/13] tests: Add test case for assigned enumerator
  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 ` Jaskaran Singh
  0 siblings, 0 replies; 2+ messages in thread
From: Jaskaran Singh @ 2020-03-08  8:43 UTC (permalink / raw)
  To: cocci; +Cc: linux-kernel-mentees

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 12:53 [Cocci] [PATCH 12/13] tests: Add test case for assigned enumerator Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
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 12/13] tests: Add test case for assigned enumerator Jaskaran Singh

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git