-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Add ability to comment in transport version files #134329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,4 +354,41 @@ public void testSupports() { | |
assertThat(new TransportVersion(null, 100001000, null).supports(test4), is(true)); | ||
assertThat(new TransportVersion(null, 100001001, null).supports(test4), is(true)); | ||
} | ||
|
||
public void testComment() { | ||
byte[] data1 = ("#comment" + System.lineSeparator() + "1000000").getBytes(StandardCharsets.UTF_8); | ||
TransportVersion test1 = TransportVersion.fromBufferedReader( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: seems these are all exactly the same test, just with a different comment before the same id. perhaps it could be moved to a helper function that takes the data as a string? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll see if I can make a helper in a separate PR for all the tests that use this byte array. |
||
"<test>", | ||
"testSupports3", | ||
false, | ||
true, | ||
new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data1), StandardCharsets.UTF_8)), | ||
5000000 | ||
); | ||
assertThat(new TransportVersion(null, 1000000, null).supports(test1), is(true)); | ||
|
||
byte[] data2 = (" # comment" + System.lineSeparator() + "1000000").getBytes(StandardCharsets.UTF_8); | ||
TransportVersion test2 = TransportVersion.fromBufferedReader( | ||
"<test>", | ||
"testSupports3", | ||
false, | ||
true, | ||
new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data2), StandardCharsets.UTF_8)), | ||
5000000 | ||
); | ||
assertThat(new TransportVersion(null, 1000000, null).supports(test2), is(true)); | ||
|
||
byte[] data3 = ("#comment" + System.lineSeparator() + "# comment3" + System.lineSeparator() + "1000000").getBytes( | ||
StandardCharsets.UTF_8 | ||
); | ||
TransportVersion test3 = TransportVersion.fromBufferedReader( | ||
"<test>", | ||
"testSupports3", | ||
false, | ||
true, | ||
new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data3), StandardCharsets.UTF_8)), | ||
5000000 | ||
); | ||
assertThat(new TransportVersion(null, 1000000, null).supports(test3), is(true)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this means we don't support comments anywhere in the file, only in the beginning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Since this is our internal format, I didn't think it was worth additional parsing complexity to make it work anywhere.