-
Notifications
You must be signed in to change notification settings - Fork 112
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
Ensures macros can be evaluated from both byte array and InputStream sources. #956
Conversation
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 attempted to add the changes in this file to #954; I think I forgot to commit the additional changes after the file move was automatically staged by Git.
@@ -2497,6 +2497,7 @@ private boolean slowReadMacroInvocationHeader(IonTypeID valueTid, Marker markerT | |||
macroInvocationId = valueTid.macroId; | |||
} | |||
setUserMacroInvocationMarker(valueTid, markerToSet, -1); | |||
setCheckpoint(CheckpointLocation.BEFORE_UNANNOTATED_TYPE_ID); |
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.
This is the fix that allows InputStreams to work.
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.
More changes related to the move of EncodingDirectiveReader.
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.
Drive-by change, see #953 (comment)
public void structAsParameter() throws Exception { | ||
@ParameterizedTest | ||
@EnumSource(InputType.class) | ||
public void structAsParameter(InputType inputType) throws Exception { |
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.
This is an example of a test that failed for InputType.INPUT_STREAM
before the fix in IonCursorBinary.
* Reads encoding directives from the given [IonReader]. This performs a similar function to | ||
* IonReaderContinuableCoreBinary.EncodingDirectiveReader, though that one requires more logic to handle continuable | ||
* input. The two could be unified at the expense of higher complexity than is needed by the non-continuable text | ||
* implementation. If the text reader is replaced with a continuable implementation in the future, | ||
* IonReaderContinuableCoreBinary.EncodingDirectiveReader should be moved to the top level and shared by both readers. | ||
* If that were to happen, this class would no longer be needed. | ||
*/ |
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.
This kind of comment is so valuable, thanks!
Description of changes:
RC2 focused on byte array inputs. This PR adds testing for InputStream inputs (which are handled slightly differently in some cases by the binary reader), and includes a fix to IonCursorBinary to make the tests pass.
Before this fix, some of the tests would fail because the cursor's checkpoint was not advanced after reading a macro invocation header, causing the header to be read repetitively.
This PR also includes some minor cleanups that somehow didn't make it into the final revision of my previous PR.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.