Skip to content

modules/test: provide access to expect function #2843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

MattSturgeon
Copy link
Member

@MattSturgeon MattSturgeon commented Jan 17, 2025

Allow test.warnings and test.assertions to be defined as either a list, or a function coerced to a list.

When defined as a function, it is supplied an expect function which provides some syntactic-sugar for defining simple expectations.

This is an alternative to the current approach of defining that expect function on an ad-hoc basis.

I prefer this to adding expect to nixvim's lib because:

  1. That would require having access to lib
  2. IDK where in lib such a specialized function should live

Note: this can also be used in #2738

image

@MattSturgeon MattSturgeon requested a review from a team January 17, 2025 01:46
Copy link
Contributor

@khaneliman khaneliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thank you

@MattSturgeon

This comment was marked as outdated.

This comment was marked as outdated.

Allow `test.warnings` and `test.assertions` to be defined as either a
list, or a function coerced to a list.

When defined as a function, it is supplied an `expect` function which
provides some syntactic-sugar for defining simple expectations.

This is an alternative to the current approach of defining that `expect`
function on an ad-hoc basis.

I prefer this to adding `expect` to nixvim's lib because:
1. That would require having access to `lib`
2. IDK where in `lib` such a specialized function should live

This comment was marked as outdated.

@MattSturgeon

This comment was marked as resolved.

This comment was marked as resolved.

@MattSturgeon
Copy link
Member Author

@mergify queue

Copy link
Contributor

mergify bot commented Jan 17, 2025

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at ff29c97

Copy link
Contributor

mergify bot commented Jan 17, 2025

This pull request, with head sha ff29c977236a0cd1ccd4144d4eab8ef2333e079d, has been successfully merged with fast-forward by Mergify.

This pull request will be automatically closed by GitHub.

As soon as GitHub detects that the sha ff29c977236a0cd1ccd4144d4eab8ef2333e079d is part of the main branch, it will mark this pull request as merged.

It is possible for this pull request to remain open if this detection does not happen, this usually happens when a force-push is done on this branch test_expect_fn, this means GitHub will fail to detect the merge.

@mergify mergify bot merged commit ff29c97 into nix-community:main Jan 17, 2025
4 checks passed
@MattSturgeon MattSturgeon deleted the test_expect_fn branch January 17, 2025 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants