Skip to content

Turn eqeq in doc comments to asserts for testing #7531

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 2 commits into from
Jun 2, 2025

Conversation

DZakh
Copy link
Member

@DZakh DZakh commented May 28, 2025

Makes it possible to change assertEqual to == in doc comments to improve readability, while keeping the test safety

Copy link

pkg-pr-new bot commented May 28, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7531

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7531

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7531

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7531

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7531

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7531

commit: a6e7595

@DZakh DZakh requested a review from cknitt May 28, 2025 09:28
@cknitt
Copy link
Member

cknitt commented Jun 2, 2025

Nice!
So this enables additional tests that were not converted to assertEqual yet but have == in their doc comments, and all those tests are passing, right?

Next steps (in separate PRs) could then be

  • convert the assertEquals back to doc comments with == (checking that the same tests are still executed)
  • logging warnings about doc comments in the stdlib/runtime that don't have an == check yet?

@DZakh
Copy link
Member Author

DZakh commented Jun 2, 2025

So this enables additional tests that were not converted to assertEqual yet but have == in their doc comments, and all those tests are passing, right?

Yes.

convert the assertEquals back to doc comments with == (checking that the same tests are still executed)

Yes, it would be nice to have an automatic check that the script correctly detected ==, since the parsing logic is not the most reliable. Requiring == per interface and having a warning/error for this sounds like a good solution

@cknitt cknitt merged commit 1db1fc4 into master Jun 2, 2025
16 checks passed
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