Sha256: bf067b819fb8552cbc1f3b30fdf6651eb47de57f68810635b016d96f6084ff48

Contents?: true

Size: 1.09 KB

Versions: 21

Compression:

Stored size: 1.09 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(['age', '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

21 entries across 21 versions & 2 rubygems

Version Path
protobuf-1.4.2 test/check_unbuild.rb
protobuf-1.4.1 test/check_unbuild.rb
protobuf-1.4.0 test/check_unbuild.rb
protobuf-1.3.0 test/check_unbuild.rb
protobuf-1.1.3 test/check_unbuild.rb
protobuf-1.1.2 test/check_unbuild.rb
protobuf-1.1.1 test/check_unbuild.rb
protobuf-1.1.0.beta2 test/check_unbuild.rb
protobuf-1.1.0.beta1 test/check_unbuild.rb
protobuf-1.1.0.beta0 test/check_unbuild.rb
protobuf-1.0.1 test/check_unbuild.rb
protobuf-1.0.0 test/check_unbuild.rb
ruby_protobuf-0.4.11 test/check_unbuild.rb
ruby_protobuf-0.4.10 test/check_unbuild.rb
ruby_protobuf-0.4.9 test/check_unbuild.rb
ruby_protobuf-0.4.8 test/check_unbuild.rb
ruby_protobuf-0.4.7 test/check_unbuild.rb
ruby_protobuf-0.4.6 test/check_unbuild.rb
ruby_protobuf-0.4.5 test/check_unbuild.rb
ruby_protobuf-0.4.4 test/check_unbuild.rb