From cb1d42de518514b3d3ee07e85c36e26e7570916e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 10 Jul 2026 00:53:13 -0500 Subject: fix(test-runner): reject a sibling dir that shares the test dir's prefix cj/test--do-focus-add-file tested containment with a bare string-prefix-p on two truenames, so tests-old/foo.el passed as being inside tests/ and joined the focus list. The correct helper was already there. cj/test--file-in-directory-p wraps the directory in file-name-as-directory first, and the other two call sites already used it. This one didn't. The helper even had a sibling-rejection test. It was proven correct while the call site two hundred lines away never called it, which is why the new test drives the real focus-add path with a tests-old/ directory on disk rather than testing the helper again. --- modules/test-runner.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/test-runner.el b/modules/test-runner.el index e05145e4..7f157f1c 100644 --- a/modules/test-runner.el +++ b/modules/test-runner.el @@ -239,7 +239,10 @@ Returns: \\='success if added successfully, Second value is the relative filename if successful." (cond ((null filepath) (cons 'no-file nil)) - ((not (string-prefix-p (file-truename testdir) (file-truename filepath))) + ;; Route through the helper: it appends the trailing slash, so a sibling + ;; sharing the directory's name prefix (tests-old/ against tests/) is + ;; rejected. A bare `string-prefix-p' on the truenames accepts it. + ((not (cj/test--file-in-directory-p filepath testdir)) (cons 'not-in-testdir nil)) (t (let ((relative (file-relative-name filepath testdir))) -- cgit v1.2.3