Skip to content

Commit

Permalink
Adds test to show encode fail with enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudio Ortolina committed Jun 17, 2014
1 parent 401a895 commit d763718
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/protobuf/encoder_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ defmodule Protobuf.Encoder.Test do
message WithRepeatedSubMsg {
repeated Msg f1 = 1;
}
message WithEnum {
enum Version {
V1 = 1;
V2 = 2;
}
required Version version = 1;
}
"}
end

Expand All @@ -31,4 +40,10 @@ defmodule Protobuf.Encoder.Test do
msg = mod.WithRepeatedSubMsg.new(f1: [mod.Msg.new(f1: 1)])
assert <<10, 2, 8, 1>> == E.encode(msg, mod.WithRepeatedSubMsg.defs)
end

test "encodes enums", var do
mod = var[:mod]
msg = mod.WithEnum.new(version: :'V1')
IO.inspect E.encode(msg, mod.WithEnum.defs)
end
end

0 comments on commit d763718

Please sign in to comment.