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

chore: improve link parser and its tests a bit #5522

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Jul 23, 2024

  • Adds a few more tests
  • Switches to QCompareCaseInsensitive and std::set (no more allocations when searching for domains)

That's the most coverage we can get out of it (codecov doesn't really show which cases were covered in case of partial coverage).

None of the following checks will trigger, because there will always be three dots and never duplicated dots (guaranteed from the caller, parse):

if (lastWasDot || octetNumber == 3)

I could remove them, but that makes it a bit more fragile.

Similar things go for

return octetNumber == 3 && !lastWasDot;

With the only difference that we're not guaranteed that host doesn't end in . (there's a test for it).

@pajlada pajlada merged commit a2cbe63 into Chatterino:master Jul 23, 2024
18 of 19 checks passed
@Nerixyz Nerixyz deleted the test/linkparser branch July 24, 2024 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants