parent
9abf6e2ab0
commit
1d39f78818
3 changed files with 79 additions and 23 deletions
@ -0,0 +1,20 @@ |
||||
#!/usr/bin/ruby |
||||
|
||||
# multi_level_nesting_test_pb.rb is in the same directory as this test. |
||||
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) |
||||
|
||||
require 'test/unit' |
||||
require 'multi_level_nesting_test_pb' |
||||
|
||||
# |
||||
# Provide tests for having messages nested 3 levels deep |
||||
# |
||||
class MultiLevelNestingTest < Test::Unit::TestCase |
||||
|
||||
def test_levels_exist |
||||
assert ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Function").msgclass |
||||
assert ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Function.Parameter").msgclass |
||||
assert ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Function.Parameter.Value").msgclass |
||||
end |
||||
|
||||
end |
@ -0,0 +1,25 @@ |
||||
# |
||||
# 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 |
Loading…
Reference in new issue