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

[TEST] refactor UrlParser tests to use value-paramterized tests #3153

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

sjinks
Copy link
Contributor

@sjinks sjinks commented Nov 19, 2024

As discussed in #3146

Changes

This PR refactors the UrlParser tests to make them more readable and use value-parametrized tests.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@sjinks sjinks requested a review from a team as a code owner November 19, 2024 21:51
Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 3cc6bcb
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/673ee4e6a253d700082346e6


#include "opentelemetry/ext/http/common/url_parser.h"

namespace http_common = opentelemetry::ext::http::common;

inline const char *BoolToString(bool b)
struct ParsedUrl
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used a dedicated structure instead of std::map<std::string, std::string> because map's operator[] may change the map (if a key does not exist, it will create a default-constructed value and put it into the map). Test data must be immutable.

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.86%. Comparing base (fe68d51) to head (3cc6bcb).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3153   +/-   ##
=======================================
  Coverage   87.86%   87.86%           
=======================================
  Files         195      195           
  Lines        6151     6151           
=======================================
  Hits         5404     5404           
  Misses        747      747           
---- 🚨 Try these New Features:

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix.

@marcalff marcalff changed the title test: refactor UrlParser tests to use value-paramterized tests [TEST] refactor UrlParser tests to use value-paramterized tests Nov 20, 2024
@marcalff
Copy link
Member

Waiting a bit for possible comments, then will merge.

@marcalff marcalff merged commit 4341e12 into open-telemetry:main Nov 22, 2024
57 checks passed
@sjinks sjinks deleted the refactor-url-parser-tests branch November 22, 2024 22:36
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.

3 participants