diff options
Diffstat (limited to 'tests/multiple_files')
-rw-r--r-- | tests/multiple_files/SConscript | 13 | ||||
-rw-r--r-- | tests/multiple_files/callbacks.proto | 16 | ||||
-rw-r--r-- | tests/multiple_files/callbacks2.proto | 9 | ||||
-rw-r--r-- | tests/multiple_files/test_multiple_files.c | 12 |
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; +} |