Add a test case for removing Parameter attributes. The test case checks
correct removal of the attribute when it is:

- before the parameter type.
- after the parameter type and before the parameter identifier.
- after the parameter identifier.

Signed-off-by: Jaskaran Singh <jaskaransingh7654...@gmail.com>
---
 tests/remove_param_attrs.c     | 11 +++++++++++
 tests/remove_param_attrs.cocci | 13 +++++++++++++
 tests/remove_param_attrs.res   | 11 +++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 tests/remove_param_attrs.c
 create mode 100644 tests/remove_param_attrs.cocci
 create mode 100644 tests/remove_param_attrs.res

diff --git a/tests/remove_param_attrs.c b/tests/remove_param_attrs.c
new file mode 100644
index 00000000..8ec1ffde
--- /dev/null
+++ b/tests/remove_param_attrs.c
@@ -0,0 +1,11 @@
+int func1(int x, __nocast int y) {
+       return 0;
+}
+
+int func2(int x, int __nocast y) {
+       return 0;
+}
+
+int func3(int x, int y __nocast) {
+       return 0;
+}
diff --git a/tests/remove_param_attrs.cocci b/tests/remove_param_attrs.cocci
new file mode 100644
index 00000000..43f5a204
--- /dev/null
+++ b/tests/remove_param_attrs.cocci
@@ -0,0 +1,13 @@
+@@
+type T,U;
+attribute name __nocast;
+identifier x,y;
+@@
+
+T x(
+    ...,
+    U y
+-      __nocast
+    ,
+    ...
+  ) {...}
diff --git a/tests/remove_param_attrs.res b/tests/remove_param_attrs.res
new file mode 100644
index 00000000..3705e814
--- /dev/null
+++ b/tests/remove_param_attrs.res
@@ -0,0 +1,11 @@
+int func1(int x, int y) {
+       return 0;
+}
+
+int func2(int x, int y) {
+       return 0;
+}
+
+int func3(int x, int y) {
+       return 0;
+}
-- 
2.21.1

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

Reply via email to