diff --git a/.gitignore b/.gitignore index 4e745ebea5c0..44ab2d49ef48 100644 --- a/.gitignore +++ b/.gitignore @@ -192,6 +192,7 @@ ruby/tests/generated_code_pb.rb ruby/tests/test_import_pb.rb ruby/tests/test_ruby_package_pb.rb ruby/tests/generated_code_proto2_pb.rb +ruby/tests/multi_level_nesting_test_pb.rb ruby/tests/test_import_proto2_pb.rb ruby/tests/test_ruby_package_proto2_pb.rb ruby/Gemfile.lock diff --git a/Makefile.am b/Makefile.am index 99bd4c79f5ac..d8b9fda140a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1148,6 +1148,8 @@ ruby_EXTRA_DIST= \ ruby/tests/generated_code_proto2_test.rb \ ruby/tests/generated_code_proto2.proto \ ruby/tests/generated_code.proto \ + ruby/tests/multi_level_nesting_test.proto \ + ruby/tests/multi_level_nesting_test.rb \ ruby/tests/test_import_proto2.proto \ ruby/tests/test_import.proto \ ruby/tests/test_ruby_package_proto2.proto \ diff --git a/ruby/Rakefile b/ruby/Rakefile index 2d020e7173ba..3e3da055d3f2 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -104,7 +104,9 @@ genproto_output << "tests/test_ruby_package.rb" genproto_output << "tests/test_ruby_package_proto2.rb" genproto_output << "tests/basic_test.rb" genproto_output << "tests/basic_test_proto2.rb" +genproto_output << "tests/multi_level_nesting_test.rb" genproto_output << "tests/wrappers.rb" + file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task| sh "../src/protoc --ruby_out=. tests/generated_code.proto" end @@ -137,6 +139,10 @@ file "tests/basic_test_proto2.rb" => "tests/basic_test_proto2.proto" do |file_ta sh "../src/protoc -I../src -I. --ruby_out=. tests/basic_test_proto2.proto" end +file "tests/multi_level_nesting_test.rb" => "tests/multi_level_nesting_test.proto" do |file_task| + sh "../src/protoc -I../src -I. --ruby_out=. tests/multi_level_nesting_test.proto" +end + file "tests/wrappers.rb" => "../src/google/protobuf/wrappers.proto" do |file_task| sh "../src/protoc -I../src -I. --ruby_out=tests ../src/google/protobuf/wrappers.proto" end diff --git a/ruby/tests/multi_level_nesting_test.proto b/ruby/tests/multi_level_nesting_test.proto new file mode 100644 index 000000000000..84c3fa4c07f8 --- /dev/null +++ b/ruby/tests/multi_level_nesting_test.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +message Function { + string name = 1; + repeated Function.Parameter parameters = 2; + string return_type = 3; + + message Parameter { + string name = 1; + Function.Parameter.Value value = 2; + + message Value { + oneof type { + string string = 1; + int64 integer = 2; + } + } + } +} diff --git a/ruby/tests/multi_level_nesting_test_pb.rb b/ruby/tests/multi_level_nesting_test_pb.rb deleted file mode 100644 index b51b53149992..000000000000 --- a/ruby/tests/multi_level_nesting_test_pb.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Provide tests for having messages nested 3 levels deep -# - -require 'google/protobuf' - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_file("function_call.proto", :syntax => :proto3) do - add_message "Function" do - optional :name, :string, 1 - repeated :parameters, :message, 2, "Function.Parameter" - optional :return_type, :string, 3 - end - add_message "Function.Parameter" do - optional :name, :string, 1 - optional :value, :message, 2, "Function.Parameter.Value" - end - add_message "Function.Parameter.Value" do - oneof :type do - optional :string, :string, 1 - optional :integer, :int64, 2 - end - end - end -end