Skip to content
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

Improved regular expression for data-sets when functional flag is used. #914

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

tommyseus
Copy link
Contributor

@tommyseus tommyseus commented Dec 5, 2024

Hi, I have problems with the function flag and data providers.

1st Problem
I have tests with more than 10 data sets and numeric keys.

The regex as it is generated now does not properly filter the test for the wrapper.

"%s\s.*1.*$/" (matches with keys 1, 11, 12, 13, ...)

This leads to strange results on the cli.

.................... 20 / 20 (100%)
. 21 / 20 (105%)
. 22 / 20 (110%)
. 23 / 20 (114%)
. 24 / 20 (120%)

I have fixed it by using dataSetAsString and removed the willdcards from the regex.

2nd Problem

Some tests are using the class name as key for the data-provider.

The regex is not properly escaped for class names.
I fixed it using preg_quote.


I tried to reflect the problem in the unit test adjustments. Without the SuiteLoader adjustments the tests will fail.

Manually tested only with PHP 8.3.

@Slamdunk Slamdunk added the bug label Dec 5, 2024
@Slamdunk Slamdunk merged commit 9ac8eda into paratestphp:7.x Dec 5, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants