Skip to content

Turn eqeq in doc comments to asserts for testing#7531

Merged
cknitt merged 2 commits intomasterfrom
dz/turn-docs-eqeq-to-assert
Jun 2, 2025
Merged

Turn eqeq in doc comments to asserts for testing#7531
cknitt merged 2 commits intomasterfrom
dz/turn-docs-eqeq-to-assert

Conversation

@DZakh
Copy link
Copy Markdown
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

@pkg-pr-new
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
@github-actions github-actions Bot deleted the dz/turn-docs-eqeq-to-assert branch February 27, 2026 00:23
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