From fdc5bd9000b6fcbd10e968fcff74f59753b0b748 Mon Sep 17 00:00:00 2001 From: Andrew Hickman Date: Wed, 3 Apr 2024 22:20:27 +0100 Subject: [PATCH] Add regression test for #57 (#58) --- Cargo.lock | 62 ++++--------------- protox/Cargo.toml | 4 +- protox/tests/compare.rs | 1 + .../message_name_field_name_conflict.proto | 17 +++++ 4 files changed, 32 insertions(+), 52 deletions(-) create mode 100644 protox/tests/data/message_name_field_name_conflict.proto diff --git a/Cargo.lock b/Cargo.lock index cf8a64c..cb9caea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.7" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" [[package]] name = "beef" @@ -398,36 +398,13 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "logos" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" -dependencies = [ - "logos-derive 0.13.0", -] - [[package]] name = "logos" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "161971eb88a0da7ae0c333e1063467c5b5727e7fb6b710b8db4814eade3a42e8" dependencies = [ - "logos-derive 0.14.0", -] - -[[package]] -name = "logos-codegen" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" -dependencies = [ - "beef", - "fnv", - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn", + "logos-derive", ] [[package]] @@ -441,26 +418,17 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "regex-syntax 0.8.2", + "regex-syntax", "syn", ] -[[package]] -name = "logos-derive" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" -dependencies = [ - "logos-codegen 0.13.0", -] - [[package]] name = "logos-derive" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c2a69b3eb68d5bd595107c9ee58d7e07fe2bb5e360cc85b0f084dedac80de0a" dependencies = [ - "logos-codegen 0.14.0", + "logos-codegen", ] [[package]] @@ -604,7 +572,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.2", + "regex-syntax", "rusty-fork", "tempfile", "unarray", @@ -657,12 +625,12 @@ dependencies = [ [[package]] name = "prost-reflect" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9372e3227f3685376a0836e5c248611eafc95a0be900d44bc6cdf225b700f" +checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f" dependencies = [ "base64", - "logos 0.13.0", + "logos", "miette", "once_cell", "prost", @@ -708,7 +676,7 @@ name = "protox-parse" version = "0.6.0" dependencies = [ "insta", - "logos 0.14.0", + "logos", "miette", "proptest", "prost-types", @@ -778,7 +746,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata 0.4.5", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] @@ -795,15 +763,9 @@ checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.2" diff --git a/protox/Cargo.toml b/protox/Cargo.toml index 14da58c..ba35e8e 100644 --- a/protox/Cargo.toml +++ b/protox/Cargo.toml @@ -44,7 +44,7 @@ bytes = "1.5.0" clap = { version = "4.5.2", features = ["derive"], optional = true } miette = "7.2.0" prost = "0.12.1" -prost-reflect = { version = "0.13.0", features = ["miette", "text-format"] } +prost-reflect = { version = "0.13.1", features = ["miette", "text-format"] } prost-types = "0.12.1" protox-parse = { version = "0.6.0", path = "../protox-parse" } thiserror = "1.0.57" @@ -52,7 +52,7 @@ thiserror = "1.0.57" [dev-dependencies] insta = { version = "1.36.1", features = ["yaml"] } prost-build = { version = "0.12.1" } -prost-reflect = { version = "0.13.0", features = ["serde"] } +prost-reflect = { version = "0.13.1", features = ["serde"] } once_cell = { version = "1.12.0", default_features = false } scopeguard = "1.1.0" serde_yaml = "0.9.32" diff --git a/protox/tests/compare.rs b/protox/tests/compare.rs index 3d2591e..7906e9e 100644 --- a/protox/tests/compare.rs +++ b/protox/tests/compare.rs @@ -159,6 +159,7 @@ compare!(reserved_ranges); compare!(oneof_group_field); compare!(service); compare!(option_group_field); +compare!(message_name_field_name_conflict); #[test] fn google_protobuf_any() { diff --git a/protox/tests/data/message_name_field_name_conflict.proto b/protox/tests/data/message_name_field_name_conflict.proto new file mode 100644 index 0000000..7ca0be3 --- /dev/null +++ b/protox/tests/data/message_name_field_name_conflict.proto @@ -0,0 +1,17 @@ +// Regression test for https://github.com/andrewhickman/protox/issues/57 +syntax = "proto3"; + +message Parent { + ChildMessage ChildMessage = 1; + ChildEnum ChildEnum = 2; +} + +message ChildMessage { + string field = 1; +} + +enum ChildEnum { + UNKNOWN = 0; + A = 1; + B = 2; +} \ No newline at end of file