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

[PATCH v2 0/3] t: rework tests for --pathspec-from-file

From
AGAlexandr Miloslavskiy via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 30, 2019, 19:15 UTC
Message-ID
<pull.503.v2.git.1577733329.gitgitgadget@gmail.com>
In-Reply-To
<pull.503.git.1577727747.gitgitgadget@gmail.com>
Please refer to commit messages for rationale.
This branch is a follow-up for [1] where part of branch was merged into `master` via [2].

Previously in [3] there were some concerns on whether removing copy&pasted tests is good. I still think that yes, it 's a good thing, mostly because of high volume of potential 13*6=78 duplicate tests.

Still, I separated this change as last patch, so that the remaining part of the branch can be taken without it.

[1] https://lore.kernel.org/git/pull.490.git.1576161385.gitgitgadget@gmail.com/ [2] https://public-inbox.org/git/pull.445.v4.git.1575381738.gitgitgadget@gmail.com/ [3] https://lore.kernel.org/git/xmqqwoatcn5u.fsf@gitster-ct.c.googlers.com/

Changes since V1 ---------------- Small code formatting changes suggested in V1.

Alexandr Miloslavskiy (3):
  t: fix quotes tests for --pathspec-from-file
  t: directly test parse_pathspec_file()
  t: drop copy&pasted tests for --pathspec-from-file
 Makefile                            |   1 +
 t/helper/test-parse-pathspec-file.c |  33 +++++++++
 t/helper/test-tool.c                |   1 +
 t/helper/test-tool.h                |   1 +
 t/t0067-parse_pathspec_file.sh      | 104 ++++++++++++++++++++++++++++
 t/t2026-checkout-pathspec-file.sh   |  70 +------------------
 t/t2072-restore-pathspec-file.sh    |  70 +------------------
 t/t3704-add-pathspec-file.sh        |  70 +------------------
 t/t7107-reset-pathspec-file.sh      |  79 +++------------------
 t/t7526-commit-pathspec-file.sh     |  70 +------------------
 10 files changed, 156 insertions(+), 343 deletions(-)
 create mode 100644 t/helper/test-parse-pathspec-file.c
 create mode 100755 t/t0067-parse_pathspec_file.sh
base-commit: 0a76bd7381ec0dbb7c43776eb6d1ac906bca29e6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-503%2FSyntevoAlex%2F%230207(git)_2b_test_parse_directly-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-503/SyntevoAlex/#0207(git)_2b_test_parse_directly-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/503
Range-diff vs v1:
 1:  ab9519298d = 1:  6193dc7396 t: fix quotes tests for --pathspec-from-file
 2:  27383a5b08 ! 2:  ab449ac15a t: directly test parse_pathspec_file()
     @@ -55,9 +55,8 @@
      +	parse_pathspec_file(&pathspec, 0, 0, 0, pathspec_from_file,
      +			    pathspec_file_nul);
      +
     -+	for (i = 0; i < pathspec.nr; i++) {
     ++	for (i = 0; i < pathspec.nr; i++)
      +		printf("%s\n", pathspec.items[i].original);
     -+	}
      +
      +	clear_pathspec(&pathspec);
      +	return 0;
     @@ -99,84 +98,99 @@
      +. ./test-lib.sh
      +
      +test_expect_success 'one item from stdin' '
     -+	echo fileA.t | test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	fileA.t
      +	EOF
     ++
     ++	echo fileA.t |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
      +test_expect_success 'one item from file' '
     -+	echo fileA.t >list &&
     -+	test-tool parse-pathspec-file --pathspec-from-file=list >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	fileA.t
      +	EOF
     ++
     ++	echo fileA.t >list &&
     ++	test-tool parse-pathspec-file --pathspec-from-file=list >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
      +test_expect_success 'NUL delimiters' '
     -+	printf "fileA.t\0fileB.t\0" | test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	fileA.t
      +	fileB.t
      +	EOF
     ++
     ++	printf "fileA.t\0fileB.t\0" |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
      +test_expect_success 'LF delimiters' '
     -+	printf "fileA.t\nfileB.t\n" | test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	fileA.t
      +	fileB.t
      +	EOF
     ++
     ++	printf "fileA.t\nfileB.t\n" |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
      +test_expect_success 'no trailing delimiter' '
     -+	printf "fileA.t\nfileB.t" | test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	fileA.t
      +	fileB.t
      +	EOF
     ++
     ++	printf "fileA.t\nfileB.t" |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
      +test_expect_success 'CRLF delimiters' '
     -+	printf "fileA.t\r\nfileB.t\r\n" | test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	fileA.t
      +	fileB.t
      +	EOF
     ++
     ++	printf "fileA.t\r\nfileB.t\r\n" |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
      +test_expect_success 'quotes' '
     ++	cat >expect <<-\EOF &&
     ++	fileA.t
     ++	EOF
     ++
      +	# shell  takes \\\\101 and spits \\101
      +	# printf takes   \\101 and spits  \101
      +	# git    takes    \101 and spits     A
     -+	printf "\"file\\\\101.t\"" | test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
     ++	printf "\"file\\\\101.t\"" |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- >actual &&
      +
     -+	cat >expect <<-\EOF &&
     -+	fileA.t
     -+	EOF
      +	test_cmp expect actual
      +'
      +
      +test_expect_success '--pathspec-file-nul takes quotes literally' '
     -+	# shell  takes \\\\101 and spits \\101
     -+	# printf takes   \\101 and spits  \101
     -+	printf "\"file\\\\101.t\"" | test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual &&
     -+
      +	cat >expect <<-\EOF &&
      +	"file\101.t"
      +	EOF
     ++
     ++	# shell  takes \\\\101 and spits \\101
     ++	# printf takes   \\101 and spits  \101
     ++	printf "\"file\\\\101.t\"" |
     ++	test-tool parse-pathspec-file --pathspec-from-file=- --pathspec-file-nul >actual &&
     ++
      +	test_cmp expect actual
      +'
      +
 3:  daef256db3 = 3:  88086cebce t: drop copy&pasted tests for --pathspec-from-file
-- 
gitgitgadget
Previous: Alexandr Miloslavskiy via GitGitGadgetNext: Alexandr Miloslavskiy via GitGitGadget
Message 7 of 26 in “t: rework tests for --pathspec-from-file”
  1. 0/3 t: rework tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  2. 1/3 t: fix quotes tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  3. 2/3 t: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  4. Junio C HamanoDec 30, 2019
  5. Alexandr MiloslavskiyDec 30, 2019
  6. 3/3 t: drop copy&pasted tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  7. 0/3 t: rework tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  8. 2/3 t: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  9. 1/3 t: fix quotes tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  10. Eric SunshineDec 30, 2019
  11. Jonathan NiederDec 31, 2019
  12. Alexandr MiloslavskiyDec 31, 2019
  13. 3/3 t: drop copy&pasted tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 30, 2019
  14. 0/3 t: rework tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  15. 2/3 t: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  16. 1/3 t: fix quotes tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  17. 3/3 t: drop copy&pasted tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  18. 0/3 t: rework tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  19. 1/3 t: fix quotes tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  20. 2/3 t: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  21. 3/3 t: drop copy&pasted tests for --pathspec-from-fileAlexandr Miloslavskiy via GitGitGadget, Dec 31, 2019
  22. Junio C HamanoJan 7, 2020
  23. Alexandr MiloslavskiyJan 8, 2020
  24. Junio C HamanoJan 8, 2020
  25. Alexandr MiloslavskiyJan 8, 2020
  26. Junio C HamanoJan 8, 2020

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.