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

Re: [PATCH v2 4/4] t4018: add tests for javascript export type function declarations

From
Johannes Sixt <j6t@kdbg.org>
Date
Jun 26, 2025, 06:21 UTC
Message-ID
<df3f9190-79cd-49d6-934c-a67a2c0c9f0d@kdbg.org>
In-Reply-To
<20250623090538.154858-5-derick.william.moraes@gmail.com>

Many of the cases are not valid tests. In particular the word "ChangeMe" must occur *only once* and *after* the line with "RIGHT" and there must be at least one unchanged line before it. (I wonder how these tests could have passed. Do we have a flaw in the test driver?)

Show 9 quoted lines
> diff --git a/t/t4018/javascript-dotexpors-async-anonymous-function b/t/t4018/javascript-dotexpors-async-anonymous-function
> new file mode 100644
> index 0000000000..9f970a2343
> --- /dev/null
> +++ b/t/t4018/javascript-dotexpors-async-anonymous-function
> @@ -0,0 +1,3 @@
> +exports.RIGHT = async function(a, b) {
> +    return a + b; // ChangeMe
> +};
Here.
Show 9 quoted lines
> diff --git a/t/t4018/javascript-dotexports-anonymous-function b/t/t4018/javascript-dotexports-anonymous-function
> new file mode 100644
> index 0000000000..2fa9775c95
> --- /dev/null
> +++ b/t/t4018/javascript-dotexports-anonymous-function
> @@ -0,0 +1,3 @@
> +exports.RIGHT = function(a, b) {
> +    return a + b; //ChangeMe
> +};
Here.
Show 7 quoted lines
> diff --git a/t/t4018/javascript-dotexports-arrow-function-3 b/t/t4018/javascript-dotexports-arrow-function-3
> new file mode 100644
> index 0000000000..cc3f1ec017
> --- /dev/null
> +++ b/t/t4018/javascript-dotexports-arrow-function-3
> @@ -0,0 +1 @@
> +exports.RIGHT = a => a+1; //ChangeMe
Here.
And many more. You see the pattern.
Show 8 quoted lines
> +++ b/t/t4018/javascript-module-dotexports-generator-function
> @@ -0,0 +1,5 @@
> +module.exports.RIGHT = function* ChangeMe() {
> +
> +    yield 1;
> +    yield 2;
> +}
> \ No newline at end of file

An incomplete last line, again. Please look at the patch text that you are going to submit. Don't depend on reviewers' to notice such obvious glitches.

I haven't found enough time for a complete review, yet. Please submit a patch series that does not depend on an earlier round.

Splitting the test cases in separate patches is a good idea. I think you have chosen a split that excercises different hunk header patterns. But in this case, it would also be feasible and helpful to exclude the pattern from the earlier patch and add the pattern and the corresponding test cases in the same commit.

-- Hannes
Previous: Derick W. de M. Frias
Message 11 of 11 in “userdiff: add javascript diff driver”
  1. 0/1 userdiff: add javascript diff driverDerick W. de M. Frias, Jun 4, 2025
  2. 1/1 userdiff: add javascript diff driverDerick W. de M. Frias, Jun 4, 2025
  3. D. Ben KnobleJun 4, 2025
  4. Johannes SixtJun 5, 2025
  5. 0/4 diff: create pattern for javascript languageDerick W. de M. Frias, Jun 23, 2025
  6. 2/4 t4034: add tests for javascript word literalsDerick W. de M. Frias, Jun 23, 2025
  7. 3/4 t4018: add tests for recognizing javascript function syntaxDerick W. de M. Frias, Jun 23, 2025
  8. 1/4 userdiff: add javascript diff driverDerick W. de M. Frias, Jun 23, 2025
  9. Junio C HamanoJun 23, 2025
  10. 4/4 t4018: add tests for javascript export type function declarationsDerick W. de M. Frias, Jun 23, 2025
  11. Johannes SixtJun 26, 2025

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.