Add basic proto3 test

Same code of the proto2 test but with the corresponding proto3 file
This commit is contained in:
Paolo Borelli 2016-10-25 22:03:31 +02:00
parent 8194f4d91a
commit 2f22519f58
2 changed files with 59 additions and 0 deletions

View File

@ -185,6 +185,29 @@ BUILT_SOURCES += \
t/test-full.pb.cc t/test-full.pb.h \
t/generated-code2/test-full-cxx-output.inc
if BUILD_PROTO3
check_PROGRAMS += \
t/generated-code3/test-generated-code3
TESTS += \
t/generated-code3/test-generated-code3
t_generated_code3_test_generated_code3_LDADD = \
protobuf-c/libprotobuf-c.la
t_generated_code3_test_generated_code3_SOURCES = \
t/generated-code/test-generated-code.c \
t/test-proto3.pb-c.c
t/test-proto3.pb-c.c t/test-proto3.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-proto3.proto
$(AM_V_GEN)@PROTOC@ --plugin=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-proto3.proto
BUILT_SOURCES += \
t/test-proto3.pb-c.c t/test-proto3.pb-c.h
endif # BUILD_PROTO3
t_version_version_SOURCES = \
t/version/version.c
t_version_version_LDADD = \
@ -197,6 +220,7 @@ EXTRA_DIST += \
t/test.proto \
t/test-full.proto \
t/test-optimized.proto \
t/test-proto3.proto \
t/generated-code2/common-test-arrays.h
#

35
t/test-proto3.proto Normal file
View File

@ -0,0 +1,35 @@
syntax = "proto3";
package foo;
message Person {
string name = 1;
int32 id = 2;
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phone = 4;
}
message LookupResult
{
Person person = 1;
}
message Name {
string name = 1;
};
service DirLookup {
rpc ByName (Name) returns (LookupResult);
}