Sha256: 27fdf13ac3d4f7ba57a8120d70df4e7ccf43e08eb79d6cd88bc991b8490121bc

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

# encoding: UTF-8

require File.dirname(__FILE__) + '/test_helper'

class TextFormatTest < Test::Unit::TestCase

  context "a message called Test1 with one int32 field" do
    # from http://code.google.com/apis/protocolbuffers/docs/overview.html#whynotxml
    setup do
      fields = [Protopuffs::String.new("required", "name", 1),
                Protopuffs::String.new("required", "email", 2)]
      Protopuffs::Message::Base.define_message_class("Person", fields)
      @message = Protopuffs::Message::Person.new
      @message.name = "John Doe"
      @message.email = "jdoe@example.com"
    end

    should "return the correct text format from #inspect" do
      assert_equal %Q(person {\n  name: "John Doe"\n  email: "jdoe@example.com"\n}), @message.inspect
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
chrisk-protopuffs-0.2.1 test/text_format_test.rb
chrisk-protopuffs-0.3.0 test/text_format_test.rb
protopuffs-0.3.0 test/text_format_test.rb