Skip to content

Rename test classes from Test* to *Test #1359

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
May 6, 2025
Merged

Rename test classes from Test* to *Test #1359

merged 2 commits into from
May 6, 2025

Conversation

st0012
Copy link
Member

@st0012 st0012 commented May 4, 2025

Since class names are usually nouns, test classes should be named like ClassNameTest instead of TestClassName.

This convention is now commonly used in projects (e.g. Rails) and tools like Ruby LSP use it to check if a class is a test class. (From tools' perspective, checking Test as a postfix is more accurate than checking Test as a prefix as TestHelper, TestCase...etc. are not test classes.)

I've previously renamed some classes this way. This commit renames all remaining classes to follow the convention.

Copy link

cloudflare-workers-and-pages bot commented May 4, 2025

Deploying rdoc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 50b216f
Status: ✅  Deploy successful!
Preview URL: https://22278d14.rdoc-6cd.pages.dev
Branch Preview URL: https://rename-test-classes.rdoc-6cd.pages.dev

View logs

@simi
Copy link

simi commented May 4, 2025

It will make sense to rename files as well IMHO to keep it consistent.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

st0012 added 2 commits May 6, 2025 11:25
Since class names are usually nouns, test classes should be named
like `ClassNameTest` instead of `TestClassName`.

This convention is now commonly used in projects (e.g. Rails) and tools
like Ruby LSP use it to check if a class is a test class.
(From tools' perspective, checking `Test` as a postfix is more accurate
than checking `Test` as a prefix as `TestHelper`, `TestCase`...etc. are
not test classes.)

I've previously renamed some classes this way. This commit renames all
remaining classes to follow the convention.
@st0012 st0012 force-pushed the rename-test-classes branch from ab18204 to 50b216f Compare May 6, 2025 03:25
@st0012
Copy link
Member Author

st0012 commented May 6, 2025

I've renamed the test files too. It'd require almost all opened PRs to rebase, but it should be rather easy to do.

@st0012
Copy link
Member Author

st0012 commented May 6, 2025

Windows head CI are failing for unrelated reasons. Merging now

@st0012 st0012 merged commit 0b9433d into master May 6, 2025
58 of 60 checks passed
@st0012 st0012 deleted the rename-test-classes branch May 6, 2025 03:35
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.

3 participants