Add specs for File.match?
from fast-glob
#15604
Merged
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.
Imports test cases for
File.match?
from https://github.com/oxc-project/fast-glob/blob/main/tests/test.rs to enhance the spec suite.I'm planning to fix issue #15319 by porting the matching algorithm from
fast-glob
to Crystal. This is a preparatory step to import the test cases from the base implementation. Our currentmatch_spec.cr
lacks unit tests for many edge cases, which are covered here. Importing them beforehand makes it clear to identify the differences in behaviour, and it's easier to review in smaller bites.I figure it should be easier to maintain this as a separate test file with a generator to easily include new test from upstream.
Most of the examples originate from other projects, bash and minimatch.
In violation of the DO NOT EDIT directive, I'm encoding the currently broken test cases directly in the generated file. This will be fixed shortly in #15607.
The original tests also include a list of more complex patterns, which are tested against a huge list of paths. I'm skipping them here because they need specific code to run them, and add them separately. They're all broken anyway due to #15319.
Similarly, some fuzz specs are also a bit more complex for a simple transform, so they'll be added separately as well.
Related: #15601