git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GSoC][PATCH] t: migrate helper/test-urlmatch-normalization to unit tests

From
Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Date
Jul 22, 2024, 12:54 UTC
Message-ID
<D2W30F19QN7J.146CV16OMTO6M@gmail.com>
In-Reply-To
<CAOLa=ZQ8fuCksk+CGP2thMqKnT_KME4goLwEt6hKYvt+Gbn5tw@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> wrote:
Show 31 quoted lines
> Ghanshyam Thakkar <shyamthakkar001@gmail.com> writes:
>
> [snip]
>
> > +static void compare_normalized_urls(const char *url1, const char *url2,
> > +				    size_t equal)
> [ 5 more citation lines. Click/Enter to show. ]
> > +{
> > +	char *url1_norm = url_normalize(url1, NULL);
> > +	char *url2_norm = url_normalize(url2, NULL);
> > +
> > +	if (equal) {
> > +		if (!check_str(url1_norm, url2_norm))
> > +			test_msg("input url1: %s\n  input url2: %s", url1,
> > +				 url2);
>
> check_str() checks and prints the values if they don't match, so here
> since the normalized urls will be printed by check_str(), we print the
> input urls. Makes sense.
>
> > +	} else if (!check_int(strcmp(url1_norm, url2_norm), !=, 0))
> > +		test_msg(" url1_norm: %s\n   url2_norm: %s\n"
> > +			 "  input url1: %s\n  input url2: %s",
> > +			 url1_norm, url2_norm, url1, url2);
>
> Here we use strcmp and hence, it won't print the normalized urls, so we
> also print them. This is because we want to make sure they are not
> equal.
>
> I don't understand why there is inconsistent spacing in this message
> though.

That is for alignment purposes, so the ':' matches vertically between them. I.e.

#  url1_norm: https://@x.y/%5E
   url2_norm: https://x.y/%5E
  input url1: https://@x.y/^
  input url2: httpS://x.y:443/^
  
Thanks.
> Apart from this small question, the patch looks great!
>
> Thanks
Previous: Karthik NayakNext: Karthik Nayak
Message 4 of 23 in “t: migrate helper/test-urlmatch-normalization to unit tests”
  1. Ghanshyam ThakkarJun 28, 2024
  2. Ghanshyam ThakkarJul 9, 2024
  3. Karthik NayakJul 22, 2024
  4. Ghanshyam ThakkarJul 22, 2024
  5. Karthik NayakJul 23, 2024
  6. Patrick SteinhardtJul 23, 2024
  7. Ghanshyam ThakkarJul 24, 2024
  8. Patrick SteinhardtJul 24, 2024
  9. Ghanshyam ThakkarJul 24, 2024
  10. Patrick SteinhardtJul 24, 2024
  11. [GSoC][PATCH v2] t: migrate t0110-urlmatch-normalization to the new frameworkGhanshyam Thakkar, Aug 13, 2024
  12. Junio C HamanoAug 13, 2024
  13. Kaartic SivaraamAug 14, 2024
  14. Junio C HamanoAug 14, 2024
  15. Ghanshyam ThakkarAug 14, 2024
  16. Kaartic SivaraamAug 14, 2024
  17. [GSoC][PATCH v3] t: migrate t0110-urlmatch-normalization to the new frameworkGhanshyam Thakkar, Aug 14, 2024
  18. Junio C HamanoAug 14, 2024
  19. Christian CouderAug 19, 2024
  20. [GSoC][PATCH v4] t: migrate t0110-urlmatch-normalization to the new frameworkGhanshyam Thakkar, Aug 20, 2024
  21. Ghanshyam ThakkarAug 20, 2024
  22. Christian CouderAug 21, 2024
  23. Junio C HamanoAug 21, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.