can we maybe extend the pattern list in the filetype_extensions.conf used for the unittests on the fly?

We'd have to update filetype_extensions.conf, run unit tests, and then revert back to the original filetype_extensions.conf. If someone interrupts the unit test by Ctrl+C, the original version wouldn't be restored which makes this approach a little fragile.

No, the filetype_extension.conf used in the unittests is already a copy in a custom directory -- the goal being installing a "vanilla" confdir, and IIRC back in the days the layout of the source data/ directory wasn't fitting.

Anyway, it's a mere matter of doing something like this:

diff --git a/tests/ctags/runner.sh b/tests/ctags/runner.sh
index e03beda09..775654006 100755
--- a/tests/ctags/runner.sh
+++ b/tests/ctags/runner.sh
@@ -14,7 +14,10 @@ trap 'rm -rf "$TMPDIR"' EXIT
 # related configuration files
 mkdir -p "$CONFDIR" || exit 99
 mkdir -p "$CONFDIR/filedefs/" || exit 99
-cp "${top_srcdir:-../..}"/data/filetype_extensions.conf "$CONFDIR" || exit 99
+# Add *.Filetype_unittest extension so we can match filetypes for which there
+# are no extension patterns, like e.g. Meson.
+sed 's/^\([^=[]\{1,\}\)\(=[^;]\{1,\}\(;[^;]\{1,\}\)*\);*$/\1\2;*.\1_unittest;/' \
+  < "${top_srcdir:-../..}"/data/filetype_extensions.conf > "$CONFDIR/filetype_extensions.conf" || exit 99
 cp "${top_srcdir:-../..}"/data/filedefs/filetypes.* "$CONFDIR/filedefs/" || exit 99
 
 shift

It's indeed not very pretty, but it would do the job with relatively little effort, and no impact on "real" config. Yes it add one layer of magic, but aren't shell script here for this? 😁

I can prepare a PR if you're happy enough with this.

PS: yes, I know about sed -r and + quantifier, but IIRC macos's sed doesn't, so I tried to be portable. Testing on oddball tollting welcome.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/issues/4074/2629548476@github.com>