From 4c06fedde76b50367bd45bbbdb23f1bcceed7261 Mon Sep 17 00:00:00 2001 From: Dieter Komendera Date: Wed, 30 Oct 2024 22:12:54 +0100 Subject: [PATCH] Vendor s-index-of in test utils instead of requiring s --- Eldev | 2 +- test/clojure-ts-mode-indentation-test.el | 2 +- test/test-helper.el | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Eldev b/Eldev index 2030e26..e6b3c00 100644 --- a/Eldev +++ b/Eldev @@ -10,7 +10,7 @@ (eldev-use-plugin 'autoloads) -(eldev-add-extra-dependencies 'test 'buttercup 's) +(eldev-add-extra-dependencies 'test 'buttercup) (setq byte-compile-docstring-max-column 240) (setq checkdoc-force-docstrings-flag nil) diff --git a/test/clojure-ts-mode-indentation-test.el b/test/clojure-ts-mode-indentation-test.el index be77588..e4d73a6 100644 --- a/test/clojure-ts-mode-indentation-test.el +++ b/test/clojure-ts-mode-indentation-test.el @@ -43,7 +43,7 @@ DESCRIPTION is a string with the description of the spec." (declare (indent 1)) `(it ,description (let* ((after ,after) - (expected-cursor-pos (1+ (s-index-of "|" after))) + (expected-cursor-pos (1+ (clojure-ts--s-index-of "|" after))) (expected-state (delete ?| after))) (with-clojure-ts-buffer ,before (goto-char (point-min)) diff --git a/test/test-helper.el b/test/test-helper.el index 38bce56..3866003 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -46,4 +46,13 @@ and point left there." (delete-char -1) ,@body))) +(defun clojure-ts--s-index-of (needle s &optional ignore-case) + "Returns first index of NEEDLE in S, or nil. + +If IGNORE-CASE is non-nil, the comparison is done without paying +attention to case differences." + (declare (pure t) (side-effect-free t)) + (let ((case-fold-search ignore-case)) + (string-match-p (regexp-quote needle) s))) + ;;; test-helper.el ends here