Skip to content

Commit

Permalink
test: use test_messages_proto{2,3}.proto
Browse files Browse the repository at this point in the history
Also
1) generate test data for parsing tests on the fly
2) remove more redundant tests
  • Loading branch information
ahamez committed Feb 26, 2025
1 parent 4fb613a commit 4dcd9ee
Show file tree
Hide file tree
Showing 15 changed files with 329 additions and 1,522 deletions.
8 changes: 4 additions & 4 deletions lib/protox/merge_message.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ defmodule Protox.MergeMessage do
- both are `nil`: `nil` is returned
# Example
iex> r1 = %Protobuf2{a: 0, s: :ONE}
iex> r2 = %Protobuf2{a: nil, s: :TWO}
iex> r1 = %Protobuf2Message{a: 0, b: :ONE}
iex> r2 = %Protobuf2Message{a: nil, b: :TWO}
iex> Protox.MergeMessage.merge(r1, r2)
%Protobuf2{a: 0, s: :TWO}
%Protobuf2Message{a: 0, b: :TWO}
iex> Protox.MergeMessage.merge(r2, r1)
%Protobuf2{a: 0, s: :ONE}
%Protobuf2Message{a: 0, b: :ONE}
"""
@spec merge(struct() | nil, struct() | nil) :: struct() | nil
def merge(nil, from), do: from
Expand Down
4 changes: 2 additions & 2 deletions test/code_generation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defmodule Protox.CodeGenerationTest do

Mix.Tasks.Protox.Generate.run([
"--output-path=#{tmp_file}",
"#{protox_path}/test/samples/proto3.proto"
"#{protox_path}/test/samples/google/test_messages_proto3.proto"
])

assert File.exists?(tmp_file)
Expand Down Expand Up @@ -110,7 +110,7 @@ defmodule Protox.CodeGenerationTest do
[
"protox.generate",
"--output-path=./lib/output/#{output}",
"#{protox_path}/test/samples/proto3.proto"
"#{protox_path}/test/samples/google/test_messages_proto3.proto"
] ++ args,
cd: code_generation_path
)
Expand Down
Loading

0 comments on commit 4dcd9ee

Please sign in to comment.