-
Notifications
You must be signed in to change notification settings - Fork 238
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
Fix wrong disregarding of not closed markup, such as lone <
#679
Conversation
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## master #679 +/- ##
==========================================
- Coverage 65.16% 65.16% -0.01%
==========================================
Files 38 38
Lines 17851 17845 -6
==========================================
- Hits 11633 11628 -5
+ Misses 6218 6217 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
} else { | ||
Ok(Some(&buf[start..])) | ||
} | ||
Ok((&buf[start..], done)) |
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.
done
ought to be renamed to found
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.
Actually, all that code will be removed soon, because I rewrite it, so not necessary to polish it. That changes was made only because I plan to make tests first to know that rewriting did not break anything
…te was found or not Co-authored-by: Daniel Alley <dalley@redhat.com>
failures: issue622
…, because we inside a tag An opened `<` character was already read when we call read_element, so we MUST to find `>` or return a syntax error
… None, because we inside a markup An opened `<` character was already read when we call read_bang_element, so we MUST to find `>` or return a syntax error
`read` in read_bang_element was at least 1, but then branch in any case could be reachable only if .read_buf() returns empty array, but in that case we have already exited with the correct error
The 1st commit is a preparation step.
The 2nd adds a regression test.
The 3rd commit fixes #622.
The bug was in two parts:
Event::Eof
inread_until_close!
macro. We are inside a markup at this moment, so we cannot return EOF event.OpenedTag
state fromClosedTag
state. It is assumed that inOpenedTag
we already have seen and have consumed the<
character, but becauseread_byte_until
could return bytes without seeing the searched byte we could go toOpenedTag
state when<
was not seen. In that case the first part of a bug have masked problem in most cases.I also noticed other problems near to fixed code, so the commits 4 and 5 fixes them:
read_element
andread_bang_element
are called inside of a tag or bang markup (i. e. after seeing<
character), so they must return a corresponding event or an error. The last commit just a refactoring of that fixes, that also removes dead code arised due to a typo.