Improve tests embebbing#40
Merged
Merged
Conversation
dmytro-kashcheiev
requested changes
May 27, 2026
Collaborator
dmytro-kashcheiev
left a comment
There was a problem hiding this comment.
@Vladyslav-Kuksiuk LGTM with minor comment.
There was a problem hiding this comment.
Pull request overview
This PR extends embed-code’s glob-based matching to support multi-line start/end/line patterns separated by \n, and adds support for writing quotes in XML attributes as \" (converted to " internally). It updates documentation and adds new test fixtures + test cases to validate the behavior.
Changes:
- Add multi-line pattern parsing/matching for
start,end, andlinepatterns using\nseparators (with\\nfor literal\ntext). - Allow backslash-escaped quotes (
\") in<embed-code ...>XML attributes by converting them to"before XML unmarshalling. - Add new embedding/parsing tests and documentation examples; bump version to
1.2.1.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
embedding/parsing/pattern.go |
Adds multi-line pattern splitting and matching helpers. |
embedding/parsing/instruction.go |
Implements multi-line matching for line, and multi-line-aware start/end matching. |
embedding/parsing/xml_parse.go |
Preprocesses \" into " prior to xml.Unmarshal. |
embedding/parsing/instruction_test.go |
Adds tests for \" parsing and literal glob-character escaping. |
embedding/embedding_test.go |
Adds end-to-end embedding tests covering multi-line patterns and literal \\n matching. |
EMBEDDING.md |
Documents multi-line patterns and escaping rules (including \"). |
test/resources/docs/escaped-newline-pattern.md |
New doc fixture for multi-line start/end patterns. |
test/resources/docs/escaped-newline-exact-pattern.md |
New doc fixture for exact (^...$) multi-line patterns. |
test/resources/docs/escaped-newline-line-pattern.md |
New doc fixture for multi-line line patterns. |
test/resources/docs/escaped-newline-literal-pattern.md |
New doc fixture for matching literal \\n text. |
test/resources/code/java/org/example/MultiLinePatternSample.java |
New code fixture used by multi-line pattern embedding tests. |
test/resources/code/java/literal-patterns.txt |
New text fixture for literal wildcard/caret/dollar matching tests. |
main.go |
Bumps application version to 1.2.1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dmytro-kashcheiev
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves pattern-based embedding by adding explicit multi-line matching for
start,endandlinepatterns. Instead of requiring a single source line to identify a fragment boundary, patterns can now use\nto match consecutive source lines.For example:
Each line in a multi-line pattern follows the same glob rules as regular one-line patterns, including
^and$for exact matching.Spaces around
\nare ignored.Additional change: added possibility to write quote characters in patterns as
\"instead of the XML entity".Resolves #44.