branch: externals/matlab-mode
commit b5c985bab1a8eccaa21429aa73fc0d6b623be0c8
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: simplify sweep testing
---
tests/Makefile | 4 ++++
tests/sweep-test-matlab-ts-grammar.sh | 4 ++--
tests/sweep-test-matlab-ts-mode-indent.sh | 2 +-
tests/test-matlab-ts-mode-parser.sh | 4 ++--
tests/test-tree-sitter-utils.sh | 28 +++++++++++++++++++---------
5 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
index b07953c4aa..00084f102a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -101,6 +101,10 @@ $(RUN_T_UTILS_TEST):
-eval '(t-utils-run "$(RUN_T_UTILS_TEST).el")'
endif
+.PHONY: disp-matlab-ts-dir
+disp-matlab-ts-dir:
+ @echo $(MATLAB_TS_DIR)
+
# [eof] tests/Makefile
# LocalWords: EMACSFLAGS setq ifneq modetests shelltests metest mstest eof
utils treesit ifeq env
diff --git a/tests/sweep-test-matlab-ts-grammar.sh
b/tests/sweep-test-matlab-ts-grammar.sh
index b5b9f65b4f..1fa7721fe5 100755
--- a/tests/sweep-test-matlab-ts-grammar.sh
+++ b/tests/sweep-test-matlab-ts-grammar.sh
@@ -4,7 +4,7 @@
#
# See ./README-TEST-MATLAB-TREE-SITTER.org for usage.
#
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# Copyright (C) 2025-2026 Free Software Foundation, Inc.
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
@@ -12,7 +12,7 @@ SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &>
/dev/null && pwd)
set -x
-emacs --batch -q "${tsExtraLoadPath[@]}" \
+emacs --batch -q --eval "(setq treesit-extra-load-path (list
\"$TS_EXTRA_LOAD_DIR\"))" \
-L "$EmacsMATLABModeDir" \
-l "$EmacsMATLABModeDir/matlab-autoload.el" \
-L "$EmacsMATLABModeDir/tests" \
diff --git a/tests/sweep-test-matlab-ts-mode-indent.sh
b/tests/sweep-test-matlab-ts-mode-indent.sh
index dbda13dce7..d2dcab2827 100755
--- a/tests/sweep-test-matlab-ts-mode-indent.sh
+++ b/tests/sweep-test-matlab-ts-mode-indent.sh
@@ -12,7 +12,7 @@ SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &>
/dev/null && pwd)
set -x
-emacs --batch -q "${tsExtraLoadPath[@]}" \
+emacs --batch -q --eval "(setq treesit-extra-load-path (list
\"$TS_EXTRA_LOAD_DIR\"))" \
-L "$EmacsMATLABModeDir" \
-l "$EmacsMATLABModeDir/matlab-autoload.el" \
-L "$EmacsMATLABModeDir/tests" \
diff --git a/tests/test-matlab-ts-mode-parser.sh
b/tests/test-matlab-ts-mode-parser.sh
index ce9b08adaf..35c877d36f 100755
--- a/tests/test-matlab-ts-mode-parser.sh
+++ b/tests/test-matlab-ts-mode-parser.sh
@@ -4,7 +4,7 @@
#
# See ./README-TEST-MATLAB-TREE-SITTER.org for usage.
#
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# Copyright (C) 2025-2026 Free Software Foundation, Inc.
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
@@ -12,7 +12,7 @@ SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &>
/dev/null && pwd)
set -x
-emacs --batch -q "${tsExtraLoadPath[@]}" \
+emacs --batch -q --eval "(setq treesit-extra-load-path (list
\"$TS_EXTRA_LOAD_DIR\"))" \
-L "$EmacsMATLABModeDir" \
-l "$EmacsMATLABModeDir/matlab-autoload.el" \
-L "$EmacsMATLABModeDir/tests" \
diff --git a/tests/test-tree-sitter-utils.sh b/tests/test-tree-sitter-utils.sh
old mode 100644
new mode 100755
index 846e77cde3..74a3dc1552
--- a/tests/test-tree-sitter-utils.sh
+++ b/tests/test-tree-sitter-utils.sh
@@ -3,9 +3,18 @@
# Abstract:
# Argument parsing for matlab tree-sitter testing which run Emacs and accept
argument:
#
-# testName.sh -libtree-sitter-matlab /PATH/TO/libtree-sitter-matlab.SLIB_EXT
+# Caller script should:
#
-# Copyright (C) 2025 Free Software Foundation, Inc.
+# SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null &&
pwd)
+# . "$SCRIPT_DIR/test-tree-sitter-utils.sh"
+# emacs --batch -q --eval "(setq treesit-extra-load-path (list
\"$TS_EXTRA_LOAD_DIR\"))" \
+# -L "$EmacsMATLABModeDir" \
+# .....
+#
+#
+# Copyright (C) 2025-2026 Free Software Foundation, Inc.
+
+SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
#----------------------------------------------#
# Get shared library extension: so, dylib, dll #
@@ -77,15 +86,16 @@ done
#-------------------------------------------------------------------------#
# -libtree-sitter-matlab /PATH/TO/libtree-sitter-matlab.SLIB_EXT handling #
#-------------------------------------------------------------------------#
-declare -a tsExtraLoadPath
-if [ "$libTreeSitterMatlab" != "" ]; then
- p=$(dirname "$libTreeSitterMatlab")
- tsExtraLoadPath=("--eval"
- "(setq treesit-extra-load-path (list \"$p\"))")
+if [ "$libTreeSitterMatlab" = "" ]; then
+ TS_EXTRA_LOAD_DIR=$(make -s -C "$SCRIPT_DIR" disp-matlab-ts-dir)
else
- tsExtraLoadPath=()
+ TS_EXTRA_LOAD_DIR=$(dirname "$libTreeSitterMatlab")
fi
-export tsExtraLoadPath
+
+#--------------------------#
+# Results for parent shell #
+#--------------------------#
+export TS_EXTRA_LOAD_DIR
EmacsMATLABModeDir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
&& cd .. && pwd)
export EmacsMATLABModeDir