Skip to content

Commit 0813087

Browse files
committed
Trailing comments support on windows
1 parent 459b722 commit 0813087

File tree

1 file changed

+45
-0
lines changed
  • wire-schema/src/commonTest/kotlin/com/squareup/wire/schema/internal/parser

1 file changed

+45
-0
lines changed

wire-schema/src/commonTest/kotlin/com/squareup/wire/schema/internal/parser/ProtoParserTest.kt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,6 +3066,51 @@ class ProtoParserTest {
30663066
assertThat(ProtoParser.parse(location, proto)).isEqualTo(expected)
30673067
}
30683068

3069+
@Test fun parsingTrailingComments() {
3070+
val proto = """
3071+
|enum ImageState {
3072+
| IMAGE_STATE_UNSPECIFIED = 0;
3073+
| IMAGE_STATE_READONLY = 1; /* unlocked */
3074+
| IMAGE_STATE_MUSTLOCK = 2; /* must be locked */
3075+
|}
3076+
""".trimMargin()
3077+
val expected = ProtoFileElement(
3078+
location = location,
3079+
types = listOf(
3080+
EnumElement(
3081+
location = location.at(1, 1),
3082+
name = "ImageState",
3083+
documentation = "",
3084+
options = listOf(),
3085+
constants = listOf(
3086+
EnumConstantElement(
3087+
location = location.at(2, 5),
3088+
name = "IMAGE_STATE_UNSPECIFIED",
3089+
tag = 0,
3090+
documentation = "",
3091+
options = listOf(),
3092+
),
3093+
EnumConstantElement(
3094+
location = location.at(3, 5),
3095+
name = "IMAGE_STATE_READONLY",
3096+
tag = 1,
3097+
documentation = "unlocked",
3098+
options = listOf(),
3099+
),
3100+
EnumConstantElement(
3101+
location = location.at(4, 5),
3102+
name = "IMAGE_STATE_MUSTLOCK",
3103+
tag = 2,
3104+
documentation = "must be locked",
3105+
options = listOf(),
3106+
),
3107+
),
3108+
),
3109+
),
3110+
)
3111+
assertThat(ProtoParser.parse(location, proto)).isEqualTo(expected)
3112+
}
3113+
30693114
@Test fun forbidMultipleSyntaxDefinitions() {
30703115
val proto = """
30713116
| syntax = "proto2";

0 commit comments

Comments
 (0)