{"id":17760558,"url":"https://github.com/fuco1/find-test","last_synced_at":"2026-02-18T17:31:47.974Z","repository":{"id":150147566,"uuid":"100615235","full_name":"Fuco1/find-test","owner":"Fuco1","description":"Simple package for jumping between implementations and tests.","archived":false,"fork":false,"pushed_at":"2019-06-22T16:38:39.000Z","size":9,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T03:36:53.456Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fuco1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-17T14:56:35.000Z","updated_at":"2020-11-02T07:34:07.000Z","dependencies_parsed_at":"2023-04-09T12:15:35.089Z","dependency_job_id":null,"html_url":"https://github.com/Fuco1/find-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Fuco1/find-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fuco1%2Ffind-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fuco1%2Ffind-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fuco1%2Ffind-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fuco1%2Ffind-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fuco1","download_url":"https://codeload.github.com/Fuco1/find-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fuco1%2Ffind-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29587082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T16:55:40.614Z","status":"ssl_error","status_checked_at":"2026-02-18T16:55:37.558Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T19:05:03.945Z","updated_at":"2026-02-18T17:31:47.931Z","avatar_url":"https://github.com/Fuco1.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# find-test\n\nSimple package for jumping between implementations and tests.\n\n# Usage\n\nUse `ft-find-test-or-source` to jump between source and test file.\n\n# How does it work\n\nThe approach taken in this package is very simple.  We opted for a little bit of configuration over unnecessary complexity in trying to be too smart.  This also allows us to be much more flexible in projects using mixed languages or non-standard layouts.\n\n# Configuration\n\nConfiguration is stored in a single buffer-local variable `ft-source-to-test-mapping`.  Its value should be a `cons` with two plists, where:\n\n* `car` is the description of the source file,\n* `cdr` is the description of the test file.\n\nBoth of these plists can contain these keys:\n\n* `:path` - part of the full path to the file\n* `:prefix` - prefix of the file\n* `:suffix` - suffix of the file, including the extension\n\nWhether a file is a source or test file is determined by first\nmatching the path to the file to the `:path` property and then\nmatching the `:prefix` and `:suffix`.\n\nTo compute the test file name from source file name the `:path`\nproperty of the source file is string-replaced with the test file\n`:path` property and then the source suffix is replaced with the test\nsuffix and vice versa; the same for the prefix.\n\n# Example configuration\n\nWe can set up mappings for a project with multiple languages easily by major mode.  Special subdirectories can be given different mappings as well.\n\n``` emacs-lisp\n;;; Directory Local Variables\n;;; For more information see (info \"(emacs) Directory Variables\")\n\n((php-mode\n  (ft-source-to-test-mapping . ((:path \"/app/\" :suffix \".php\") . (:path \"/tests/php/\" :suffix \".phpt\"))))\n (js-mode\n  (ft-source-to-test-mapping . ((:path \"/www/js/\" :suffix \".js\") . (:path \"/tests/js/\" :suffix \".spec.js\"))))\n (\"libs\"\n  (php-mode\n   (ft-source-to-test-mapping . ((:path \"/libs/\" :suffix \".php\") . (:path \"/tests/php/\" :suffix \".phpt\")))))\n (\"tests/php/Common\"\n  (php-mode\n   (ft-source-to-test-mapping . ((:path \"/libs/\" :suffix \".php\") . (:path \"/tests/php/\" :suffix \".phpt\"))))))\n```\n\nThese are some of the translations:\n\n- `/home/matus/app/Entity/Foo.php` =\u003e `/home/matus/tests/php/Foo.phpt`\n- `/home/matus/libs/Common/Bar.php` =\u003e `/home/matus/tests/php/Common/Bar.phpt`\n- `/home/matus/www/js/Entity/Foo.js` =\u003e `/home/matus/tests/js/Entity.spec.js`\n\n# Related work\n\n## find-file\n\nThe built-in package `find-file` provides a method `ff-find-other-file` which can be configured to behave somewhat similarly to the above.  However, the configuration process is rather painful as the primary purpose of that package was to jump between `.c` and `.h` files and so it assumes quite a lot of things which are not universally true.\n\nOriginally I ment to write this package as a configuration layer sitting above `find-file` (similar to how [shackle](https://github.com/wasamasa/shackle) sits on top of `display-buffer-alist`) but ultimately decided against it as the size of the implementation is currently less than 200 lines and is very very simple.\n\n## projectile\n\nThe [projectile](https://github.com/bbatsov/projectile) project provides the functionality to jump between source and test files as well but the way it is implemented does not lend very well to projects which use multiple languages or non-standard layouts.  It *can* be configured to do what you want after some effort but that effort was too much for me.  Also, the project is rather huge and comes with a lot of features one might not necessarily need.  This project provides a very light and flexible alternative.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuco1%2Ffind-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuco1%2Ffind-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuco1%2Ffind-test/lists"}