Skip to content

Commit

Permalink
Trailing comments support on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
oldergod committed Apr 15, 2024
1 parent 459b722 commit 0813087
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3066,6 +3066,51 @@ class ProtoParserTest {
assertThat(ProtoParser.parse(location, proto)).isEqualTo(expected)
}

@Test fun parsingTrailingComments() {
val proto = """
|enum ImageState {
| IMAGE_STATE_UNSPECIFIED = 0;
| IMAGE_STATE_READONLY = 1; /* unlocked */
| IMAGE_STATE_MUSTLOCK = 2; /* must be locked */
|}
""".trimMargin()
val expected = ProtoFileElement(
location = location,
types = listOf(
EnumElement(
location = location.at(1, 1),
name = "ImageState",
documentation = "",
options = listOf(),
constants = listOf(
EnumConstantElement(
location = location.at(2, 5),
name = "IMAGE_STATE_UNSPECIFIED",
tag = 0,
documentation = "",
options = listOf(),
),
EnumConstantElement(
location = location.at(3, 5),
name = "IMAGE_STATE_READONLY",
tag = 1,
documentation = "unlocked",
options = listOf(),
),
EnumConstantElement(
location = location.at(4, 5),
name = "IMAGE_STATE_MUSTLOCK",
tag = 2,
documentation = "must be locked",
options = listOf(),
),
),
),
),
)
assertThat(ProtoParser.parse(location, proto)).isEqualTo(expected)
}

@Test fun forbidMultipleSyntaxDefinitions() {
val proto = """
| syntax = "proto2";
Expand Down

0 comments on commit 0813087

Please sign in to comment.