WIP: Add testify support #130

Draft
flatplate wants to merge 3 commits from flatplate/add-testify-support into main
flatplate commented 2025-11-04 03:14:03 +03:00 (Migrated from github.com)

This PR adds support for running tests in testify suites.
Basically each test is a method on a suite struct, and the suite is run from a regular test function.

Issues

Basically it looks for a method_declaration where the struct matches ^.*TestSuite and a test function that has something like suite.Run(_, [new(@struct_name), &@struct_name{}])
Then runs the test with "test_name/method_name"

I also have two variants, one has the test defined before the method, the other one has the method defined before the test. I couldn't get it to match the tests after otherwise.

This PR adds support for running tests in testify suites. Basically each test is a method on a suite struct, and the suite is run from a regular test function. Issues - https://github.com/leoluz/nvim-dap-go/issues/98 - https://github.com/leoluz/nvim-dap-go/issues/113 Basically it looks for a method_declaration where the struct matches `^.*TestSuite` and a test function that has something like `suite.Run(_, [new(@struct_name), &@struct_name{}])` Then runs the test with `"test_name/method_name"` I also have two variants, one has the test defined before the method, the other one has the method defined before the test. I couldn't get it to match the tests after otherwise.
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin flatplate/add-testify-support:flatplate/add-testify-support
git switch flatplate/add-testify-support

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff flatplate/add-testify-support
git switch flatplate/add-testify-support
git rebase main
git switch main
git merge --ff-only flatplate/add-testify-support
git switch flatplate/add-testify-support
git rebase main
git switch main
git merge --no-ff flatplate/add-testify-support
git switch main
git merge --squash flatplate/add-testify-support
git switch main
git merge --ff-only flatplate/add-testify-support
git switch main
git merge flatplate/add-testify-support
git push origin main
Sign in to join this conversation.
No description provided.