summaryrefslogtreecommitdiff
path: root/t/t4018-diff-funcname.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-04-08 15:04:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-08 19:19:10 (GMT)
commit28e8f0d5e5a6db005fdb22c65ee0d43cf15c4b17 (patch)
treeeb721e4c85e0be2358656a968889f6e2532d6969 /t/t4018-diff-funcname.sh
parent132bf259890c1f5b29befcc68e9ed225187ca9f6 (diff)
downloadgit-28e8f0d5e5a6db005fdb22c65ee0d43cf15c4b17.zip
git-28e8f0d5e5a6db005fdb22c65ee0d43cf15c4b17.tar.gz
git-28e8f0d5e5a6db005fdb22c65ee0d43cf15c4b17.tar.bz2
userdiff tests: list builtin drivers via test-tool
Change the userdiff test to list the builtin drivers via the test-tool, using the new for_each_userdiff_driver() API function. This gets rid of the need to modify this part of the test every time a new pattern is added, see 2ff6c34612 (userdiff: support Bash, 2020-10-22) and 09dad9256a (userdiff: support Markdown, 2020-05-02) for two recent examples. I only need the "list-builtin-drivers "argument here, but let's add "list-custom-drivers" and "list-drivers" too, just because it's easy. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018-diff-funcname.sh')
-rwxr-xr-xt/t4018-diff-funcname.sh46
1 files changed, 19 insertions, 27 deletions
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index cefe329..409372f 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -25,34 +25,26 @@ test_expect_success 'setup' '
echo B >B.java
'
+test_expect_success 'setup: test-tool userdiff' '
+ # Make sure additions to builtin_drivers are sorted
+ test_when_finished "rm builtin-drivers.sorted" &&
+ test-tool userdiff list-builtin-drivers >builtin-drivers &&
+ test_file_not_empty builtin-drivers &&
+ sort <builtin-drivers >builtin-drivers.sorted &&
+ test_cmp builtin-drivers.sorted builtin-drivers &&
+
+ # Ditto, but "custom" requires the .git directory and config
+ # to be setup and read.
+ test_when_finished "rm custom-drivers.sorted" &&
+ test-tool userdiff list-custom-drivers >custom-drivers &&
+ test_file_not_empty custom-drivers &&
+ sort <custom-drivers >custom-drivers.sorted &&
+ test_cmp custom-drivers.sorted custom-drivers
+'
+
diffpatterns="
- ada
- bash
- bibtex
- cpp
- csharp
- css
- dts
- elixir
- fortran
- fountain
- golang
- html
- java
- markdown
- matlab
- objc
- pascal
- perl
- php
- python
- ruby
- rust
- tex
- default
- custom1
- custom2
- custom3
+ $(cat builtin-drivers)
+ $(cat custom-drivers)
"
for p in $diffpatterns