summaryrefslogtreecommitdiffstats
path: root/tests/multiple_files
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-11 16:13:19 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-11 16:13:19 +0300
commit61ad04afd5236e2a6a0d4b4f2caa3bab4a820c99 (patch)
treebeea1aa405bb022927fc0eb5b8f4982083b68458 /tests/multiple_files
parent5b9ad17dc2014d7506a7dde92281d8c36a1433e4 (diff)
parent9f93d39f728c3e87b0ab482aa604c5cad4b1c86e (diff)
Merge branch 'dev_tests_using_scons'
Diffstat (limited to 'tests/multiple_files')
-rw-r--r--tests/multiple_files/SConscript13
-rw-r--r--tests/multiple_files/callbacks.proto16
-rw-r--r--tests/multiple_files/callbacks2.proto9
-rw-r--r--tests/multiple_files/test_multiple_files.c12
4 files changed, 50 insertions, 0 deletions
diff --git a/tests/multiple_files/SConscript b/tests/multiple_files/SConscript
new file mode 100644
index 00000000..6b4f6b69
--- /dev/null
+++ b/tests/multiple_files/SConscript
@@ -0,0 +1,13 @@
+# Test that multiple .proto files don't cause name collisions.
+
+Import("env")
+
+incpath = env.Clone()
+incpath.Append(PROTOCPATH = '#multiple_files')
+
+incpath.NanopbProto("callbacks")
+incpath.NanopbProto("callbacks2")
+test = incpath.Program(["test_multiple_files.c", "callbacks.pb.c", "callbacks2.pb.c"])
+
+env.RunTest(test)
+
diff --git a/tests/multiple_files/callbacks.proto b/tests/multiple_files/callbacks.proto
new file mode 100644
index 00000000..ccd1edd8
--- /dev/null
+++ b/tests/multiple_files/callbacks.proto
@@ -0,0 +1,16 @@
+message SubMessage {
+ optional string stringvalue = 1;
+ repeated int32 int32value = 2;
+ repeated fixed32 fixed32value = 3;
+ repeated fixed64 fixed64value = 4;
+}
+
+message TestMessage {
+ optional string stringvalue = 1;
+ repeated int32 int32value = 2;
+ repeated fixed32 fixed32value = 3;
+ repeated fixed64 fixed64value = 4;
+ optional SubMessage submsg = 5;
+ repeated string repeatedstring = 6;
+}
+
diff --git a/tests/multiple_files/callbacks2.proto b/tests/multiple_files/callbacks2.proto
new file mode 100644
index 00000000..9a55e15a
--- /dev/null
+++ b/tests/multiple_files/callbacks2.proto
@@ -0,0 +1,9 @@
+// Test if including generated header file for this file + implicit include of
+// callbacks.pb.h still compiles. Used with test_compiles.c.
+import "callbacks.proto";
+
+message Callback2Message {
+ required TestMessage tstmsg = 1;
+ required SubMessage submsg = 2;
+}
+
diff --git a/tests/multiple_files/test_multiple_files.c b/tests/multiple_files/test_multiple_files.c
new file mode 100644
index 00000000..05722dc5
--- /dev/null
+++ b/tests/multiple_files/test_multiple_files.c
@@ -0,0 +1,12 @@
+/*
+ * Tests if this still compiles when multiple .proto files are involved.
+ */
+
+#include <stdio.h>
+#include <pb_encode.h>
+#include "callbacks2.pb.h"
+
+int main()
+{
+ return 0;
+}