Sha256: 2c8521de690c86bfc4fc919f7112175d21a200b89aa11f5075a894d68135f9e5
Contents?: true
Size: 1.07 KB
Versions: 6
Compression:
Stored size: 1.07 KB
Contents
#!/usr/bin/env ruby $:.push "#{File.dirname(__FILE__)}/../lib" require 'test/unit' require 'protobuf/descriptor/descriptor_builder' require 'protobuf/descriptor/descriptor_proto' class DescriptorTest < Test::Unit::TestCase def test_unbuild tutorial_proto = Google::Protobuf::FileDescriptorProto.new tutorial_proto.parse_from_file 'person.bin' Protobuf::Descriptor::DescriptorBuilder.build tutorial_proto assert_nothing_raised {Tutorial::Person} assert_nothing_raised {Tutorial::Person.new} assert_equal ['email', 'id', 'name', 'phone'], Tutorial::Person.fields.map{|tag, field| field.name}.sort assert_nothing_raised {Tutorial::Person::PhoneNumber} assert_nothing_raised {Tutorial::Person::PhoneNumber.new} assert_equal ['number', 'type'], Tutorial::Person::PhoneNumber.fields.map{|tag, field| field.name}.sort assert_nothing_raised {Tutorial::Person::PhoneType} assert_equal 0, Tutorial::Person::PhoneType::MOBILE assert_equal 1, Tutorial::Person::PhoneType::HOME assert_equal 2, Tutorial::Person::PhoneType::WORK end end
Version data entries
6 entries across 6 versions & 2 rubygems