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

Ada tests #714

Merged
merged 5 commits into from
Mar 16, 2023
Merged

Ada tests #714

merged 5 commits into from
Mar 16, 2023

Conversation

alandefreitas
Copy link
Member

@alandefreitas alandefreitas commented Mar 16, 2023

This PR implements the basic tests from Ada. It replicates the basic tests and a second basic test, which is based on fixtures. The Ada repository has 8 more files with fixtures. I expect we'll have about the same number of conflicts in these files so I'll describe what these conflicts are.

The tests were helpful to find bugs (5 bugs were found over 767 tests). On the other hand, Ada and node.js implement lots of exceptions for corner cases. And their tests are often exploring the very same corner cases we don't have. This means a large number of URLs (473 - 62%) have different expected results in Ada. For instance, modifying URLs in Ada might have different results depending on the scheme or even on whether some components "look like numbers".

So for each case, I had to check if it was really a bug or if the difference was intended behavior. That involved checking the RFC again. Here's a summary of the reasons why the expected results didn't match:

Summary Ada and Boost.URL conflicts
  • Useful tests: 294 (38.3%)
    • Boost.URL and Ada expected results are the same: 294 (38.3%)
  • Ada sanitizes URLs: 158 (20.6%)
    • Ada fixes URLs with invalid chars: 140 (18.3%)
    • Ada compresses port values: 2 (0.3%)
    • Ada converts and adjusts IP addresses: 16 (2.1%)
  • Different validation rules: 119 (15.5%)
    • Port overflow: 6 (0.8%)
    • Ada does not accept empty references: 5 (0.7%)
    • Ada accepts URLs with no scheme and colons: 9 (1.2%)
    • Ada accepts URLs with invalid octets: 14 (1.8%)
    • URLs considered invalid by Ada: 15 (2.0%)
    • Ada rejects empty hostname: 15 (2.0%)
    • Ada fails on paths that resemble hosts: 2 (0.3%)
    • Ada rejects URLs with invalid encoded unicode: 16 (2.1%)
    • Ada rejects overflow IPv4 which are valid reg-names: 30 (3.9%)
    • Ada accepts multiple @ in authority: 3 (0.4%)
    • Ada rejects components that look like numbers: 4 (0.5%)
  • Special scheme-based treatment: 103 (13.4%)
    • Ada has special logic for file paths: 23 (3.0%)
    • Ada rejects file URLs with ports: 2 (0.3%)
    • Invalid chars fixed in file: URLs: 10 (1.3%)
    • Ada normalizes file URLs differently: 2 (0.3%)
    • Ada rejects invalid IDNAs: 62 (8.1%)
    • Ada rejects http URLs with no authority: 1 (0.1%)
    • Special logic for unknown schemes: 3 (0.4%)
  • Ada accepts URLs with unicode: 47 (6.1%)
    • Ada accepts URLs with unicode: 47 (6.1%)
  • Different modification rules: 46 (6.0%)
    • Ada lets paths become hostnames: 17 (2.2%)
    • Boost.URL normalizes octets when resolving URLs: 10 (1.3%)
    • Ada removes dotdot segments above root (errata 4547): 16 (2.1%)
    • Ada lets path become authority: 3 (0.4%)

When the expected results don't match, the fixture in this PR includes the reason. In all cases, Boost.URL is coherent with the intended behavior we have decided.

@cppalliance-bot
Copy link

@cppalliance-bot
Copy link

@cppalliance-bot
Copy link

@cppalliance-bot
Copy link

@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Merging #714 (026c79b) into develop (565de15) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #714      +/-   ##
===========================================
+ Coverage    97.11%   97.21%   +0.10%     
===========================================
  Files          155      155              
  Lines         8461     8486      +25     
===========================================
+ Hits          8217     8250      +33     
+ Misses         244      236       -8     
Impacted Files Coverage Δ
include/boost/url/impl/url_base.ipp 99.62% <100.00%> (+<0.01%) ⬆️
include/boost/url/rfc/detail/impl/host_rule.ipp 100.00% <100.00%> (+2.43%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 565de15...026c79b. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants