Skip to content

Commit

Permalink
Add the corresponding test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dourouc05 authored Dec 29, 2023
1 parent 3ed9d24 commit 711661c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/test_parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,26 @@ end
@test p.definitions["A"].fields[1].type.reference_type == Parsers.MESSAGE
end

@testset "Single nested non-empty message proto file with default value" begin
s, p, ctx = translate_simple_proto("message A { optional string a = 1 [ default = \"b\" ]; }")

@test haskey(p.definitions, "A")
@test p.definitions["A"] isa Parsers.MessageType
@test p.definitions["A"].fields[1].name == "a"
@test p.definitions["A"].fields[1].type isa Parsers.StringType
@test p.definitions["A"].fields[1].options["default"] == "\"b\""
end

@testset "Single nested non-empty message proto file with default value on several lines" begin
s, p, ctx = translate_simple_proto("message A { optional string a = 1 [ default = \"b;\"\n\t\"c\" ]; }")

@test haskey(p.definitions, "A")
@test p.definitions["A"] isa Parsers.MessageType
@test p.definitions["A"].fields[1].name == "a"
@test p.definitions["A"].fields[1].type isa Parsers.StringType
@test p.definitions["A"].fields[1].options["default"] == "\"b;c\""
end

@testset "Single self-referential message proto file" begin
s, p, ctx = translate_simple_proto("message A { optional A a = 1; }")

Expand Down

0 comments on commit 711661c

Please sign in to comment.