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

Fix: assert_line_count #264

Merged
merged 5 commits into from
Jun 17, 2024
Merged

Fix: assert_line_count #264

merged 5 commits into from
Jun 17, 2024

Conversation

Chemaclass
Copy link
Member

📚 Description

Related to: phpstan/phpstan-src#3160 (comment)

The \n are ignored when counting the lines actual=$(echo "$input_str" | wc -l | tr -d '[:blank:]')

🔖 Changes

  • Count additionally the \n of a string on assert_line_count

Comment on lines +328 to +329
actual=$(echo "$input_str" | wc -l | tr -d '[:blank:]')
additional_new_lines=$(grep -o '\\n' <<< "$input_str" | wc -l | tr -d '[:blank:]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why/how bash represents the newline in 2 different characters.. but the tests seem to show it works.

I don't know why 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here... I just got to this solution driven by the tests, I don't understand why this works... so it's bash... 🤣

And here, yet, another proof that TDD works 😝

@Chemaclass Chemaclass requested a review from staabm June 17, 2024 21:33
@Chemaclass Chemaclass merged commit 775c8de into main Jun 17, 2024
7 checks passed
@Chemaclass Chemaclass deleted the fix/assert-line-count branch June 17, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants