[gnome-code-assistance] [tests] Added tests for C diagnostics



commit 99ab153ad13b1d1694213a19aa83d5507210d552
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Thu Nov 14 18:22:34 2013 +0100

    [tests] Added tests for C diagnostics

 tests/backends/c.json                      |   22 ++++++++++++++++++++--
 tests/backends/c/makefile/Makefile         |    4 ++++
 tests/backends/c/makefile/includes/test.hh |    7 +++++++
 tests/backends/c/makefile/test.cc          |    5 +++++
 4 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/tests/backends/c.json b/tests/backends/c.json
index b36bc4d..68ee283 100644
--- a/tests/backends/c.json
+++ b/tests/backends/c.json
@@ -1,5 +1,23 @@
 {
-  "language": "python",
+  "language": "c",
   "interfaces": [],
-  "document_interfaces": ["org.gnome.CodeAssist.v1.Diagnostics"]
+  "document_interfaces": ["org.gnome.CodeAssist.v1.Diagnostics"],
+  "diagnostics": [
+    {
+      "parse": {
+        "path": "c/makefile/test.cc"
+      },
+      "diagnostics": [
+        {
+          "severity": 4,
+          "locations": [
+            {"start": {"line": 4, "column": 8}, "end": {"line": 4, "column": 8}},
+            {"start": {"line": 4, "column": 12}, "end": {"line": 4, "column": 19}}
+          ],
+          "fixits": [],
+          "message": "cannot initialize a variable of type 'char *' with an rvalue of type 'void *'"
+        }
+      ]
+    }
+  ]
 }
diff --git a/tests/backends/c/makefile/Makefile b/tests/backends/c/makefile/Makefile
new file mode 100644
index 0000000..9629429
--- /dev/null
+++ b/tests/backends/c/makefile/Makefile
@@ -0,0 +1,4 @@
+CXXFLAGS = -Wall -Iincludes
+
+test.o: test.cc
+       $(CXX) $(CXXFLAGS) -c -o $@ $^
diff --git a/tests/backends/c/makefile/includes/test.hh b/tests/backends/c/makefile/includes/test.hh
new file mode 100644
index 0000000..510d240
--- /dev/null
+++ b/tests/backends/c/makefile/includes/test.hh
@@ -0,0 +1,7 @@
+#ifndef __TEST_HH__
+#define __TEST_HH__
+
+void *voidp();
+
+#endif /* __TEST_HH__ */
+
diff --git a/tests/backends/c/makefile/test.cc b/tests/backends/c/makefile/test.cc
new file mode 100644
index 0000000..c923507
--- /dev/null
+++ b/tests/backends/c/makefile/test.cc
@@ -0,0 +1,5 @@
+#include "test.hh"
+
+void testfunc() {
+       char *s = voidp();
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]